Need to unique count for case sensitive values

creative999

Board Regular
Joined
Jul 7, 2021
Messages
82
Office Version
  1. 365
  2. 2019
Platform
  1. Windows
  2. MacOS
Im using the formulas below to count unique values. However, just realised need to do a count based on case. Any suggestions on how i can tweak the formulas below?

=SUMPRODUCT((('SHEET1'!E3:E$5000<>"")/COUNTIF('SHEET1'!E3:E$5000,'SHEET1'!E3:E$5000&"")))
=IFERROR(SUM(--(LEN(UNIQUE(FILTER('SHEET1'!E3:E$5000, 'SHEET1'!G3:G$5000=TRUE)))>0)),0)
=IFERROR(SUM(--(LEN(UNIQUE(FILTER('SHEET1'!E3:E$5000,('SHEET1'!!H3:H$5000="AC")*('SHEET1'!!G3:G$5000=TRUE))))>0)),0)
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
Hardly just a tweak! Off the top of my head, I can only think of 2 functions that are case-aware: EXACT and CODE. I tried both, and came up with this:

Book1
EFGHIJ
1
2
3BobFALSE95
4BobTRUE
5JackTRUE
6JaneTRUE
7JACKTRUE
8BOBFALSE
9MaryFALSE
10MarYFALSE
11
12ZekeTRUE
13ZeldaFALSE
14
15
Sheet2
Cell Formulas
RangeFormula
I3I3=ROWS(UNIQUE(FILTER(E3:E5000&"|"&MMULT(IFERROR(IF(CODE(MID(E3:E5000,SEQUENCE(,10),1))<90,0,1),0),2^SEQUENCE(10)),(E3:E5000<>""))))
J3J3=ROWS(UNIQUE(FILTER(E3:E5000&"|"&MMULT(IFERROR(IF(CODE(MID(E3:E5000,SEQUENCE(,10),1))<90,0,1),0),2^SEQUENCE(10)),(E3:E5000<>"")*(G3:G5000=TRUE))))


This should work as long as the number of characters in each word in column E is no longer than 10. If it's more than that, you can change the 2 10's in the formula to something higher, but I'd start to worry about performance. These are the first 2 of your formulas, you can probably figure out the third.
 
Upvote 0
Not sure if this will perform any better than @Eric W's suggestions, or even if it is on the right track. It appears to work with a quick test assuming that I have broken down your original formula correctly.
Excel Formula:
=SUM(IFERROR(1/MMULT(EXACT('SHEET1'!E3:E$5000,TRANSPOSE('SHEET1'!E3:E$5000))*('SHEET1'!!H3:H$5000="AC")*('SHEET1'!G3:G$5000=TRUE),--'SHEET1'!G3:G$5000),0))
 
Upvote 0
A slight change to my suggestion, it works as an alternative for the second formula with the AC criteria removed, but I found that there was an error in the results for the third one when there was a row with TRUE but not AC.

Expanding the suggestion to cover all 3 formulas, I think that these should be correct.
Excel Formula:
=SUM(IFERROR(1/MMULT(EXACT(A2:A10,TRANSPOSE(A2:A10))*(A2:A10<>""),--(A2:A10<>"")),0))
Excel Formula:
=SUM(IFERROR(1/MMULT(EXACT(A2:A10,TRANSPOSE(A2:A10))*(C2:C10=TRUE),--C2:C10),0))
Excel Formula:
=SUM(IFERROR(1/MMULT(EXACT(A2:A10,TRANSPOSE(A2:A10))*(B2:B10="AC")*(C2:C10=TRUE),(B2:B10="AC")*(C2:C10=TRUE)),0))
 
Upvote 0

Forum statistics

Threads
1,214,391
Messages
6,119,244
Members
448,879
Latest member
VanGirl

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