简体   繁体   中英

Excel SUMIF criteria

I have a massive amount of data to parse through and I wanted to add total minutes watched of each show.

I was able to get a seemingly correct answer with this code:

=SUMIF(H2:H15400, "*Masterpiece", K2:K15400)

But not this:

=SUMIF(H2:H15400, "Masterpiece", K2:K15400)

which gave me 0 , and I don't know what difference the asterisk makes.

I could just use the first code but I want to draw the criteria from another row, like so:

=SUMIF(H2:H15400, AG1, K2:K15400)

but I still got zero as an answer.

As explained, the wildcard * before or after the text you want to search. If this text is in a cell (say AG1 ), you can concatenate the wildcard to it like this:

=SUMIF(H2:H15400, "*" & AG1 & "*", K2:K15400)
'                 ^^^^^^^^^^^^^^^

If you omit the right (left) wildcard, the searched string must be at the end (beginning) of the text. With the two wildcards it can occur at any place inside the text.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM