r/excel•
cnuthead

Extending a countifs formula to exclude entries that do not match another range

solved

Hi there,

I think i might have difficulty explaining what I am after, so i apologize in advance.

I have a table like below, and I want to count how many tasks the group Finance has. I was able to do this with the below formula, and the answer would come to 4.

=COUNTIFS(C2:C9,"Task",D2:D9,"Finance")

| A| B| C | D ---|---|----|----|---- A1 | Number| Task type | Group | Parent A2| TASK12345| Task| Finance | RITM12345 A3| TASK12346| Task| Finance | RITM12346 A4| TASK12347| Task| Finance | RITM12347 A5| TASK12348| Task| Finance | RITM12348 A6 | RITM12345 | RITM| | text A7 | RITM12346 | RITM| | text A8 | RITM12347 | RITM| | text

| Task ---|--- Finance | 4

I want to take this 1 step further and have the requirement to exclude counting any entry from column D, that does not exist in column B. So for our example data above, that would be RITM12348, so the number then should come to 3.

What is the best way to tackle this?

Thanks in Advance!!

Posted Feb 15, 2018, 5:41 AM UTC

26
man-teiv113•

Ok, that was challenging... try with this one. Assuming your data starts in A1 with Number, use

=SUMPRODUCT((B2:B8="Task")*(C2:C8="Finance")*NOT(ISNA(MATCH(D2:D8,A2:A8,0))))

Example

3
cnutheadOP•

SOLUTION VERIFIED!

2
Clippy_Office_AsstMOD•

You have awarded 1 point to man-teiv

1
cnutheadOP•

my man... wow. thank you! worked perfectly when editing it in my spreadsheet!

1
cnutheadOP•

SOLUTION VERIFIED!

1
AutoModeratorMOD•

Hello!

It looks like you tried to award a ClippyPoint, but you need to reply to a particular user's comment to do so, rather than making a new top-level comment.

Please reply directly to any helpful users and Clippy, our bot will take it from there. If your intention was not to award a ClippyPoint and simply mark the post as solved, then you may do that by clicking Set Flair. Thank you!

I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.

1