[Solved] Sum specific cells based on value in another cell

Discuss the spreadsheet application
Post Reply
BadPussycat
Posts: 3
Joined: Tue Feb 20, 2018 12:30 pm

[Solved] Sum specific cells based on value in another cell

Post by BadPussycat »

Hi Forum

I have the following table. And I want a sum of all Cells which are labeled as "Principal" in the column before. What is the best way to do that?

Code: Select all

		A			B	
1	price-type	price-amount
2	Principal	7,75
3	Tax			0,54
4	Principal	6,99
5	Tax			0,49
6	Principal	71,61
7	Tax			5,01
8	Principal	6,99
10	Tax			0,49
Last edited by BadPussycat on Wed Feb 21, 2018 12:52 pm, edited 1 time in total.
OpenOffice 4.1.1
User avatar
robleyd
Moderator
Posts: 5055
Joined: Mon Aug 19, 2013 3:47 am
Location: Murbko, Australia

Re: sum of specific cells based on a value in another cell

Post by robleyd »

G'day, and welcome to the community forum.

The SUMIF function should do what you want assuming the values in B are numbers, not text. Place the following in a suitable location:

Code: Select all

=SUMIF(A2:A10;"Principal"; B2:B10)
Cheers
David
OS - Slackware 15 64 bit
Apache OpenOffice 4.1.15
LibreOffice 24.2.1.2; SlackBuild for 24.2.1 by Eric Hameleers
BadPussycat
Posts: 3
Joined: Tue Feb 20, 2018 12:30 pm

Re: sum of specific cells based on a value in another cell

Post by BadPussycat »

Thanks for pointing me into the right direction. Yes the values are numbers and the coma is actually our decimal point. But somehow it doesn't work for me :( I get

#NAME?

in case I made something fundamentally wrong I attached my table the formula is in B10018
Attachments
sumif.ods
(47.1 KiB) Downloaded 91 times
OpenOffice 4.1.1
FJCC
Moderator
Posts: 9248
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: sum of specific cells based on a value in another cell

Post by FJCC »

I do not see an error in B10018. There is a SUMIF() function that returns 31977.91. The #Name error suggests that the function name is different in your locale. What settings do you see if you go to Tools -> Options, expand the Language Settings list on the left and click on Languages?
OpenOffice 4.1 on Windows 10 and Linux Mint
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
User avatar
keme
Volunteer
Posts: 3699
Joined: Wed Nov 28, 2007 10:27 am
Location: Egersund, Norway

Re: sum of specific cells based on a value in another cell

Post by keme »

If your OpenOffice install is in German, SUMIF() is translated to SUMMEWENN(). It is translated properly when opening in my Norwegian install, so I would think that the function was entered correctly in the first place. Strange...
BadPussycat
Posts: 3
Joined: Tue Feb 20, 2018 12:30 pm

[solved] Re: sum of specific cells based on a value

Post by BadPussycat »

Thank you guys now it works. But unfortunately I can not exactly say what I'm done to make it work.

I played a little bit with the language settings tried to set the language to english and also the windows settings. I basically tried it to get an English GUI for OO so I can better search for menu points if you tell me something to do. But well id didn't work. I guess I need an english language pack first. So I put all settings back to german and restart OO again. And now it works. And if I click on the formula I can see its now in German. Maybe some kind of bug. But during my research I also installed Libre Office on Win 7. Same thing doesn't work if you write the function in english (in a new install).
OpenOffice 4.1.1
Post Reply