bmarshall
bmarshall

Reputation: 13

Excel: SUMIF Based on Two Other Columns Matching

I've been attempting to find an answer on this but have not yet found something that specifically helps.

Situation:

I have two worksheets in an Excel file. In one worksheet, Worksheet: All, I have a list of every unique campaign advertisement put out by candidates during an election year. Column D has the name of the candidate who put out the ad, and column H has the total air time the ad played during the election:

Image of Worksheet: All

enter image description here

In another worksheet, Worksheet: Governors, I have a list of each governor candidate in column D:

Image of Worksheet: Governor

enter image description here

My goal is to sum up in column G the values in All!H for each candidate to get a total amount of airtime the candidate had. So, basically, I need to sum up every value of All!H for which All!D:D = Governor!D:D.

I attempt to put that into a SUMIF function:

=SUMIF(All!H:H,D:D=All!D:D)

but that gets me a 0 when I should be getting, for David Williams at least, 18360.

Upvotes: 1

Views: 71

Answers (1)

user4039065
user4039065

Reputation:

Assuming that David Williams is in Governor!D2 then put this in Governor!G2

=sumifs('all'!h:h, 'all'!d:d, d2)

Fill down as necessary to collect total airtime for the other names.

Note that SUMIF and SUMIFS have slightly different syntax. I've supplied the correct formula for a SUMIFS in case you want to add additional criteria. Your original should have been,

=sumif('all'!d:d, d2, 'all'!h:h)

Upvotes: 0

Related Questions