SUM column based on criteria of two other columns

slam

Well-known Member
Joined
Sep 16, 2002
Messages
893
Office Version
  1. 365
  2. 2019
I've been struggling to get this to work SUMIFS or INDEX/MATCH, so I'll just explain the sheet setup.

On a Totals worksheet, I am creating the formula. In column A on this worksheet is an ID (which is derived from a UNIQUE formula, if that's relevant)

On a worksheet named Raw, the same ID exists in column C, and there can be many instances of it.
Also on this worksheet, I am looking only for instances of the word Historical that appear in column A
I then want to SUM column AF.

Both worksheets have header rows, so data starts in row 2.

This is in Excel 365

Greatly appreciate the help!

<3
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
How about
Excel Formula:
=SUMIFS(Raw!AF:AF,Raw!A:A,"Historical",Raw!C:C,A2)
 
Upvote 1
Solution
SUMIFS should do it pretty easily.
Put this formula on row 2 and copy down:
Excel Formula:
=SUMIFS(Raw!AF:AF,Raw!C:C,Totals!A2,Raw!A:A,"Historical")

EDIT: I am not as fast as Fluff, but our formulas are essentially the same (it doesn't matter what order you do the criteria in).
 
Upvote 1
Thank you both - tried each of your formulas, and same result indeed! I don't know what I was doing wrong before....

I wish I could mark both answers as the solution! :)
 
Upvote 0
Thank you both - tried each of your formulas, and same result indeed! I don't know what I was doing wrong before....

I wish I could mark both answers as the solution! :)
You are welcome. Glad we were able to help!

No worries, Fluff posted his answer first, so I have no problem with you marking his as the solution.
 
Upvote 0
Hope a follow up question is ok.

I'm creating several variations of this formula now where I'm adding extra criteria. One I'm struggling with is where the year in column Z is 2024. The date format for this column is d-mmm-yy h:mm:ss

Do I need to change the formula to a SUMPRODUCT or can it still be done with SUMIFS?
 
Upvote 0
So, what exactly are you trying to do?
Return all the values that fall within a certain year?
Are you hard-coding in that year, or pulling to from a certain cell?

Regardless, you should be able to do it with a SUMPRODUCT, though there may be other options once we have a better feel for your data and desired result.
 
Upvote 0
Hi Joe,

If using the formula that you provided earlier, I would just add another criteria to it. I know this doesn't work, but to give you an idea of what I need:

Excel Formula:
=SUMIFS(Raw!AF:AF,Raw!C:C,Totals!A2,Raw!A:A,"Historical",Raw!Z:Z=2024)

I'd like to hard code the year in the formula.
 
Upvote 0
How about
Excel Formula:
=SUMIFS(Raw!AF:AF,Raw!C:C,A2,Raw!A:A,"Historical",Raw!Z:Z,">="&date(2024,1,1),Raw!Z:Z,"<"&date(2025,1,1))
Also it always best not to refer to the name of the sheet the formula is on.
 
Upvote 1

Forum statistics

Threads
1,221,532
Messages
6,160,381
Members
451,643
Latest member
nachohoyu

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top