Count unique values (not duplicates) and if an adjacent cell has certain text

willow1985

Well-known Member
Joined
Jul 24, 2019
Messages
886
Office Version
  1. 365
Platform
  1. Windows
Hello,

I am looking for a formula that will count unique values (not duplicates) in column B - the data in this column is numbers
as long as the corresponding data in Column C has the text "Completed".

Any help would be greatly appreciated.

Thank you

Carla
 
Try this array formula:

varios 10feb2020.xlsm
ABCDE
1
2TaskSTATUSUnique Completed3
354Completed
454Completed
553In progress
650In progress
749Completed
872In progress
972In progress
1072In progress
1129Completed
1245Completed
sheet
Cell Formulas
RangeFormula
E2E2=SUMPRODUCT(--IF($C$3:$C$10000<>"",IF($C$3:$C$10000<>"Completed",MATCH($B$3:$B$10000,$B$3:$B$10000,0)=ROW($B$3:$B$10000)-ROW($B$3)+1)))
Press CTRL+SHIFT+ENTER to enter array formulas surrounded with curly braces.
 
Upvote 0

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
Is there a way to modify this formula?

=SUMPRODUCT(1/COUNTIF(B3:B10000,B3:B10000))

This formula counts all unique values, but I want to add conditions on it.

This project requires having a quite a few conditions that I will be having to add going forward

1) IF column C is not "Complete"
2) IF Column F has "BLUE" OR "500"
3) IF Column F has "RED" OR "777"
4) IF Column E is not "Company Name"
5) and ALL remaining minus 2,3 and 4

Along with keeping the condition to count only if it is "Not Blank"

So it will be getting complicated and I was hoping there was a simpler way of achieving a count of unique values with additional conditions...
 
Upvote 0
I put the data in a table now, so the formula is:

=SUMPRODUCT(1/COUNTIF(ML[Task '#],ML[Task '#]))

Don't know if this will help though...
 
Upvote 0
Ok I made a dummy sheet to view.

On the Data tab highlighted in yellow are the formulas I require. They all have the same basis: counting unique values/not duplicates (tasks) with various conditions.

I figured if I had one working template I could figure out the rest. Either way here is the dummy spreadsheet with all sensitive information removed:

 
Upvote 0
Ok I made a dummy sheet to view.
But there is no example explained with the expected result.
In fact, the result a priori is 0.
There are no records that meet all conditions.

2) IF Column F has "BLUE" OR "500"
3) IF Column F has "RED" OR "777"

You can explain that condition.
Or rather it is:
2) IF Column F has "BLUE" OR "500" OR "RED" OR "777"

IF Column E is not "Company Name"
What does that mean?


and ALL remaining minus 2,3 and 4
What does that mean?
 
Upvote 0
(Reference Spreadsheet)
ConditionFormula ResultManual Method
Total Tasks Open (not complete)5filter Status to not include Completed
All tasks for "BLUE" OR "500"17filter Model to select BLUE and 500
All tasks for "RED" OR "777"3filter Model to select RED and 777
All Tasks for Company 53filter Manufacturer to select Company 5
Remaining Tasks (not BLUE, 500, RED, 777 or Company 5)16Remaining data minus the above 3 highlighted results

Hope this helps.
 
Upvote 0
(Reference Spreadsheet)
ConditionFormula ResultManual Method
Total Tasks Open (not complete)5filter Status to not include Completed
All tasks for "BLUE" OR "500"17filter Model to select BLUE and 500
All tasks for "RED" OR "777"3filter Model to select RED and 777
All Tasks for Company 53filter Manufacturer to select Company 5
Remaining Tasks (not BLUE, 500, RED, 777 or Company 5)16Remaining data minus the above 3 highlighted results

Hope this helps.

Sorry but I don't understand, do you want a formula to include all those conditions or do you want 5 formulas?
 
Upvote 0
Try this:

CellArray Formula
V2{=SUMPRODUCT(--IF($B$3:$B$10000<>"",IF($D$3:$D$10000<>"Completed",MATCH($B$3:$B$10000,$B$3:$B$10000,0)=ROW($B$3:$B$10000)-ROW($B$3)+1)))}
W2{=SUMPRODUCT(--IF($B$3:$B$10000<>"",IF((F3:F10000="BLUE")+(F3:F10000=500),MATCH($B$3:$B$10000,$B$3:$B$10000,0)=ROW($B$3:$B$10000)-ROW($B$3)+1)))}
X2{=SUMPRODUCT(--IF($B$3:$B$10000<>"",IF((F3:F10000="RED")+(F3:F10000=777),MATCH($B$3:$B$10000,$B$3:$B$10000,0)=ROW($B$3:$B$10000)-ROW($B$3)+1)))}
Y2{=SUMPRODUCT(--IF($B$3:$B$10000<>"",IF($E$3:$E$10000="Company 5",MATCH($B$3:$B$10000,$B$3:$B$10000,0)=ROW($B$3:$B$10000)-ROW($B$3)+1)))}
Z2{=SUMPRODUCT(--IF($B$3:$B$10000<>"",IF((F3:F10000<>"BLUE")*(F3:F10000<>500)*(F3:F10000<>"RED")*(F3:F10000<>777)*($E$3:$E$10000<>"Company 5"),MATCH($B$3:$B$10000,$B$3:$B$10000,0)=ROW($B$3:$B$10000)-ROW($B$3)+1)))}

 
Last edited:
Upvote 0
5 Formulas, was looking for one and then I was going to modify it for the other conditions but it seems more complicated than I thought.

Your link is not working, I get an error.

I put your formulas in and I am getting proper results.

Thank you so much
 
Last edited:
Upvote 0
I was hoping there would be simpler formulas for this put I suppose not. Thank you again for all of these!
 
Upvote 0

Forum statistics

Threads
1,214,648
Messages
6,120,726
Members
448,987
Latest member
marion_davis

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
Back
Top