Excel SUMIFS checking if a column contains text

2019-01-20 15:14发布

问题:

I have an excel document with data in a PivotTable that is displayed with several subcategories. I need to check if text anywhere in column A contains a particular word and then also check the text in column C to see if it contains a particular exact phrase.

So far, I'd come up with

=SUMIFS('tab1'!D5:D300, 'tab1'!A5:A300, "WORD", 'tab1'!C5:C300, "PHRASE")

The issue I've run into is that the excel tab this formula is checking displays information like this and it will give me the result of "0" for anything but the first phrase (which I assume is because the first phrase shares a row with the category "WORD"):

Excel Information Example:

The data in the PivotTable can change drastically throughout the year, and it is how it displays the information so I have no control over how that information is presented.

Is there a way to check if column A at any point contains a particular word, but doesn't necessarily need to match up in the appropriate row.

回答1:

=IF(INDEX(C5:C300,MATCH("WORD 2",A5:A300,0),0)<>"PHRASE","",INDEX(D5:D300,MATCH("WORD 2",A5:A300,0)))

Hope it'll help.. (:



标签: excel sumifs