Formula to count values with unique values and different criteria

Graham C1600

Board Regular
Joined
Feb 17, 2018
Messages
96
Office Version
  1. 365
[TABLE="width: 500"]
<tbody>[TR]
[TD]a
[/TD]
[TD]b
[/TD]
[TD]c
[/TD]
[TD]d
[/TD]
[TD]e
[/TD]
[TD]f
[/TD]
[/TR]
[TR]
[TD]123
[/TD]
[TD]John
[/TD]
[TD]Smith
[/TD]
[TD]01/01/2019
[/TD]
[TD]5/04/2019
[/TD]
[TD]No
[/TD]
[/TR]
[TR]
[TD]12345
[/TD]
[TD]Simon
[/TD]
[TD]Taylor
[/TD]
[TD]01/01/019
[/TD]
[TD]03/12/2018
[/TD]
[TD]No
[/TD]
[/TR]
[TR]
[TD]43433
[/TD]
[TD]June
[/TD]
[TD]Brown
[/TD]
[TD]01/01/2019
[/TD]
[TD]03/01/2019
[/TD]
[TD]Yes
[/TD]
[/TR]
[TR]
[TD]234
[/TD]
[TD]Paul
[/TD]
[TD]Baker
[/TD]
[TD]01/01/2019
[/TD]
[TD][/TD]
[TD]No
[/TD]
[/TR]
[TR]
[TD]12345
[/TD]
[TD]Rij
[/TD]
[TD]Veech
[/TD]
[TD]01/01/2019
[/TD]
[TD]03/03/019
[/TD]
[TD]No
[/TD]
[/TR]
</tbody>[/TABLE]

In Cell H1 I need a formula look down column F and ensure it looks for "No", then to look down column E3:E7 and where there is data, count column A3:A7. But I only need unique values. So in this case it would be 2.
In Cell H2 I need a formula look down column F and ensure is looks for "No", then to look down column E3:E7 and where there are blanks, count column A3:A7. But I only need unique values. So in this case it would be 1.
In Cell H3 I need to count all the cells in E3:E7 that contain data and column F also contains "No". This would be 3.
In Cell H4 I need to count all the cells in E3:E7 that are blank and column F also contains "No". This would be 1

Hope this makes sense.

Thanks in advance.
 

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
Hi Graham,

This should work...

[FONT=Verdana,Arial,Tahoma,Calibri,Geneva,sans-serif]
Book1
ABCDEFGH
123JohnSmith01/01/201905/04/2019No2
212345SimonTaylor01/01/01903/12/2018No1
343433JuneBrown01/01/201903/01/2019Yes3
4234PaulBaker01/01/2019No1
512345RijVeech01/01/201903/03/019No
Sheet1
Cell Formulas
RangeFormula
H1=SUMPRODUCT((F1:F5="No")*(E1:E5<>"")*1/COUNTIF(A1:A5,A1:A5))
H2=SUMPRODUCT((F1:F5="No")*(E1:E5="")*1/COUNTIF(A1:A5,A1:A5))
H3=SUMPRODUCT((F1:F5="No")*(E1:E5<>""))
H4=SUMPRODUCT((F1:F5="No")*(E1:E5=""))
[/FONT]
 
Upvote 0
Thanks CunningAce it works great. One final ask though if i may as i missed something off.
I also need to do the same so look down column F for a "No" but then count all the Cells down E. So this would equate to 4.

I tried the following but to no avail - =SUMPRODUCT((F1:F5="No")*(E1:E5="")*(E1:E5<>"")) suspect it has something to do with looking down the same column twice but i'm not sure.

Thanks
 
Upvote 0
No problem, you are welcome...
I don't understand your last condition though...

the formula you are trying wont work as you are looking for blanks "" and none blanks "" in the same set of cells.
 
Upvote 0
No problem, you are welcome...
I don't understand your last condition though...

the formula you are trying wont work as you are looking for blanks "" and none blanks "" in the same set of cells.

Apologies, basically I need to count all cells with either data or blank.
 
Upvote 0
Apologies, basically I need to count all cells with either data or blank.

I'm getting some strange results back. Instead of returning 3 for some i'm getting 2.3. Any ideas ?? This is when i'm using the following but on different data -
=SUMPRODUCT(
(F1:F5="No")*(E1:E5="")*1/COUNTIF(A1:A5,A1:A5)
)

 
Upvote 0
Apologies, basically I need to count all cells with either data or blank.

So this would be the same as just counting all "No's" in column F? =COUNTIF(F1:F5,"No"), Whether E has a value or not doesn't matter. The answer would be the same
 
Upvote 0
I'm getting some strange results back. Instead of returning 3 for some i'm getting 2.3. Any ideas ?? This is when i'm using the following but on different data -
=SUMPRODUCT(
(F1:F5="No")*(E1:E5="")*1/COUNTIF(A1:A5,A1:A5)
)


I would need to see the data to see the issue here
 
Upvote 0
Here you go.
A B C
ID LAST_LOGIN_TIME UTC Journey
11033158 16-MAY-19 10.15.21 No 2.333333333 *=SUMPRODUCT((C2:C20="No")*(B2:B20<>"")*1/COUNTIF(A2:A20,A2:A20))
11033158 24-MAY-19 14.47.57 No
11033158 20-MAY-19 09.57.22 No
11033158 No
11033158 22-MAY-19 14.37.38 No
11033158 17-MAY-19 09.33.06 No
11033158 No
11033158 No
11033158 03-JUN-19 12.44.59 No
11033158 No
11033158 20-MAY-19 10.27.35 No
11033158 No
11127219 09-MAY-19 16.38.23 No
11127219 23-MAY-19 09.15.38 No
11127219 No
11127219 22-MAY-19 12.11.29 No
12400549 02-MAY-19 12.28.43 No
12400549 17-MAY-19 13.05.57 No
12400549 17-MAY-19 12.29.53 No

All cells are formatted as General. The 2.3333333 is the answer from the function on the right (minus the *).

Any ideas ?

Thanks
 
Upvote 0

Forum statistics

Threads
1,223,894
Messages
6,175,254
Members
452,624
Latest member
gregg777

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