First time here? Check out the FAQ!
Hi, I'm not sure this is even possible, but I'm hoping someone can show me how if it is (and that it is). The best way I can think to describe this is to make a little diagram, so I hope this is readable.
A B C
1 5 1 A
2 7 3 B
3 2 2 A
4 9 4 C
Ok, what I want to do is make 1 cell (let's say D5, just for kicks) give me the sum of column A where column C is "A" (so 7, 5 from row 1 and 2 from row 3) and the max of column B where column C is "A" (so 2, for row 3, since row 3's 2 is higher than row 1's 1), for, in this case, a total of 9.
I tried =SUMIF(C1:C4,"A",A1:A4+MAX(B1:B4)), but that didn't work. Nor did =SUMIF(C1:C4,"A",A1:A4)+SUMIF(C1:C4,"A",MAX(B1:B4)). Both of those give Error code 504 (SUMIF doesn't like any other functions apparently). I also tried =SUMIF(C1:C4,"A",A1:A4)+IF(C1:C4,"A",MAX(B1:B4)), which doesn't give an error but gives the max of column B regardless of whether its corresponding cell in column C is "A" or not.
Is there any way to do this using only the single cell for the total (as opposed to making separate formulae for the sum of A and the max of B and then referencing those with a third formula)?
Try the "array formula":
{=SUMIF(C1:C4;"A";A1:A4)+MAX((B1:B4)*(C1:C4="A"))}
(End the entry the formula by pressing the Ctrl+Shift+Enter)
LibreOffice is made available by volunteers around the globe, backed by a charitable Foundation. Please support our efforts: Your donation helps us to deliver a better product!
Asked: 2012-07-02 07:02:25 +0200
Seen: 1,301 times
Last updated: Jul 06 '12
date format bringing up incorrect date result
How to sort pivot table by data
Paste into calc search mac does not work?
We have a spreadsheet that has a text box that cannot be edited in Calc but can be in Excel
Detect if VBA is running under LibreOffice or Excel
Content on this site is licensed under a Creative Commons Attribution Share Alike 3.0 license.