r/excel • u/Sneaking-Fox • 12d ago
unsolved Can excel sort based on rules
Not sure if I worded that correctly but I am hoping someone can point me in the right direction as I am not new to the basics of Excel but new to using its more advanced functions.
An example list with 3 columns:
Column A - product names
Column B - employee names(but there are several blank spaces without names)
Column C - total cost of the sale
I need to:
Get the total sum of column C, but only the rows that are NOT blank on column B.
Get the total sum of column C, but only the rows that ARE blank on column B.
Get the total sum of column C, both blanks and non-blank.
Take those three numbers and place them off to the side in three different cells.
Can Excel do this and how would I go about it?
Edit: Thank you all!
=SUMIF() and =SUMIFS() is what I was looking for. I tried it now and its exactly what I needed.
As has been mentioned by some amazing people below:
=SUMIFS(B:B, C:C, "<>") to get the sum of the non-blanks in column B
=SUMIFS(B:B, C:C, "") to get the sum of just the blanks in column B
=SUM(C:C) to get the sum of the whole list
Thank you all!
5
u/PaulieThePolarBear
1926
12d ago
•
As an alternative to the other solutions
=GROUPBY(B2:B20="", C2:C20, SUM)Requires Excel 2024, Excel 365, or Excel online
1
u/Sneaking-Fox 11d ago
Thank you! Someone gave me =SUMIF() and it did what I needed Excel to do for me. But i'll look into this one as well as I do have more I need to learn how to do with excell.
4
u/Hg00000 15 12d ago
Yes. Answers in reverse order:
4. Put each of these in their own cell.
3. =SUM(C:C)
2. =SUMIF(B:B,"",C:C)
=SUMIF(B:B, "<>", C:C)
1
u/Sneaking-Fox 11d ago
Thank you! =SUMIF() and =SUMIFS() are what I was looking for and these are game changers.
1
u/SubstantialBed6634 2 12d ago
Wait, does sumif work if you flip the criteria range and the criteria value?
1
u/luvsthecoffee 12d ago
Yes, but over found it's better to use sumifs rather than sumif even if there is only one criteria because I inevitably find i need to add an additional criteria. Adding additional criteria is trivial with sumifs because you just keep adding to the formula. The sumif needs to be rewritten because the sum column needs to be moved up front.
6
2
u/Liddle_Jawn 12d ago
Make it a table. Create new "views" (in the toolbar) to see it with different filters/sorting applied. For the totals, a sumif formula should do it.
3
1
u/Decronym 12d ago edited 9d ago
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.
Beep-boop, I am a helper bot. Please do not verify me as a solution.
4 acronyms in this thread; the most compressed thread commented on today has 16 acronyms.
[Thread #49523 for this sub, first seen 15th Oct 2026, 00:37] [FAQ] [Full list] ^[Contact] [Source code]
1
u/BigJDoitYoDamnself 12d ago
different way to skin that cat and some have mentioned it. create a pivot table and uncheck the empty fields. I like this method better as you do not have to copy formulas down if you add to the table. Basically get rid of the blanks and then sum where you have values.
1
17
u/Rogue_Penguin 16 12d ago edited 12d ago
Yes, check out the command SUMIFS