Countif formula to not count same cell twice

raul8

New Member
Joined
Sep 21, 2021
Messages
35
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
  2. Web
Hello everyone,

I have this formula (Thank you Eric W) that is counting the same cell twice because the "if" condition is present on that same cell twice but the intend is to look at that cell and if any of the conditions exist, to count it once only. Need some help in solving that. Thank you all!: (on the sample below, I am getting a return of 4 but I expect and it should be a return of 3)

=SUMPRODUCT(COUNTIFS(Data!C:C,{"*Hold*";"*P5*";"*P6*"},Data!AB:AB,"*BP*",Data!V:V,{"*test5*","*test3*"}))
Copy of 10_05_2021 Portfolio Validation.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
1abcdefghijklmnopqrstuvwxyzaaab
277864areaHoldtexttext2 - Hightext 8/18/2020 8:00 PM8/18/2020 8:00 PM4/29/2021 8:00 PM150000228000YellowGreentext7/30/2020 8:00 PM8/4/2020 8:00 PM8/3/2020 8:00 PMtext 9/9/2021 8:43 AM9/9/21 - text 5000001EpicNew\Management\BP
371321areaP5- texttexttext3 - Mediumtext 8/30/2021 8:00 PM7/18/2021 8:00 PM7/18/2021 8:00 PM11/12/2021 8:00 PM12/17/2021 8:00 PM5800058000GreenGreentexttext 8/30/2021 5:20 PM9/9/21 - text 540000EpicActive\Management\BP
4106537areaP5- texttexttext2 - Hightext 11/30/2021 7:00 PM8/29/2021 8:00 PM8/22/2021 8:00 PM11/30/2021 7:00 PM12/1/2021 7:00 PM5500049000GreenGreentext4/30/2021 8:00 PM7/4/2021 8:00 PM6/29/2021 8:00 PMtext Test 1 9/13/2021 7:35 AM9/9/21 - text 30000EpicActive\Management\BP
599730areaP5- texttexttext1 - Criticaltext 3/13/2022 8:00 PM3/31/2021 8:00 PM3/31/2021 8:00 PM3/30/2022 8:00 PM3/30/2022 8:00 PM800000800000GreenGreentext3/28/2021 8:00 PM3/28/2021 8:00 PMtext 6/18/2021 3:50 PM9/9/21 - text 8000000EpicActive\Management\BP
678140areaP5- texttexttext1 - Criticaltext 2/28/2022 4:00 AM12/10/2020 7:00 PM12/10/2020 7:00 PM10/14/2021 8:00 PM2/27/2022 7:00 PM159000250000GreenGreentext5/4/2020 8:00 PM11/2/2020 7:00 PM6/18/2020 8:00 PMtext Test2;test4;test5 8/3/2021 2:14 PM9/9/21 - text 510000EpicActive\Management\BP
7100849areaP5- texttexttext3 - Mediumtext 12/30/2021 7:00 PM8/31/2021 8:00 PM8/31/2021 8:00 PM11/29/2021 7:00 PM11/29/2021 7:00 PM6600066000GreenGreentexttext 8/20/2021 10:22 AM9/9/21 - text 35000EpicActive\Management\BP
8100802areaP5- texttexttext2 - Hightext 3/21/2022 7:00 PM9/20/2021 8:00 PM9/20/2021 8:00 PM4/4/2022 7:00 PM4/4/2022 7:00 PM218000218000GreenGreentext6/9/2021 12:00 AM9/20/2021 12:00 AM7/6/2021 8:00 PMtext 9/22/2021 8:33 AM9/9/21 - text EpicActive\Management\BP
9106791areaP5- texttexttext2 - Hightext 11/29/2021 7:00 PM8/19/2021 8:00 PM8/19/2021 8:00 PM12/9/2021 7:00 PM12/9/2021 7:00 PM950000950000GreenGreentext4/21/2021 12:00 AM8/23/2021 12:00 AM4/21/2021 8:00 PMtext test1 9/8/2021 9:45 AM9/9/21 - text 3750000EpicActive\Management\BP
1092436areaP5- texttexttext2 - Hightext 9/30/2021 8:00 PM3/14/2021 8:00 PM3/14/2021 8:00 PM8/30/2021 8:00 PM10/15/2021 8:00 PM165000180000GreenGreentext1/26/2021 7:00 PM3/10/2021 7:00 PM2/8/2021 7:00 PMtext test4,test3 8/3/2021 6:04 PM9/9/21 - text 2000000EpicActive\Management\BP
1194233areaP5- texttexttext3 - Mediumtext 1/31/2022 7:00 PM3/7/2021 7:00 PM3/7/2021 7:00 PM3/17/2022 8:00 PM8/25/2022 8:00 PM125000125000GreenGreentext12/17/2020 7:00 PM2/7/2021 7:00 PM12/30/2021 7:00 PMtext test1 8/24/2021 3:52 PM9/9/21 - text 1000000EpicActive\Management\BP
1255611areaP6- texttexttext3 - Mediumtext 3/25/2022 1:00 AM2/25/2021 7:00 PM2/25/2021 7:00 PM3/24/2022 8:00 PM3/24/2022 8:00 PM7200072000GreenGreentext3/3/2020 7:00 PM1/18/2021 7:00 PM4/23/2020 8:00 PMtext test3,test52/8/2021 11:55 AM9/9/21 - text 770000EpicActive\Management\BP
1378728areaP6- texttexttext2 - Hightext 8/31/2021 8:00 PM1/5/2021 7:00 PM1/5/2021 7:00 PM7/31/2021 8:00 PM11/28/2021 7:00 PM130000130000RedYellowtext7/29/2020 8:00 PM10/7/2020 8:00 PM10/1/2020 8:00 PMtext test4 9/13/2021 7:32 AM9/9/21 - text 500000EpicActive\Management\BP
Sheet4
 

Eric W

MrExcel MVP
Joined
Aug 18, 2015
Messages
11,666
A somewhat more compact way to write Fluff's formula:

Excel Formula:
=COUNT(FILTER(ROW(C2:C100),MMULT(--ISNUMBER(SEARCH({"Hold","P5","P6"},C2:C100)),{1;1;1})*ISNUMBER(SEARCH("BP",AB2:AB100))*MMULT(--ISNUMBER(SEARCH({"test5","test3"},V2:V100)),{1;1})))

This works without the FILTER like this:

Excel Formula:
=SUMPRODUCT(--(MMULT(--ISNUMBER(SEARCH({"Hold","P5","P6"},C2:C100)),{1;1;1})*ISNUMBER(SEARCH("BP",AB2:AB100))*MMULT(--ISNUMBER(SEARCH({"test5","test3"},V2:V100)),{1;1})>0))
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,147,734
Messages
5,742,863
Members
423,760
Latest member
photogfrog

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
Top