Count unique text values in excel range with blank cells

nostradamus

Board Regular
Joined
Aug 9, 2010
Messages
143
Office Version
  1. 365
Platform
  1. Windows
Hello, I have used this formula for counting unique text values, but would like to set the formula for a spreadsheet where I can copy and paste data to get the unique occurances.
But the problem I found is that I have to set the range manually each time for this formula to work properly.
For instance, here the cell range to be counted is from A2 to A26

Excel Formula:
=SUMPRODUCT(--(FREQUENCY(MATCH(A2:A26,A2:A26,0),ROW(A2:A26)-ROW(A2)+1)>0))

I would like to set the range from cells A2 to A1000, when the actual data could only be for 100 cells or 500 cells depending on the dataset I use.
So, when I set the data range in the formula upto A1000, "N/A" is my result.

Excel Formula:
=SUMPRODUCT(--(FREQUENCY(MATCH(A2:A1000,A2:A1000,0),ROW(A2:A22000)-ROW(A2)+1)>0))
Thanks in advance
 

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
How about
Excel Formula:
=SUMPRODUCT(--(FREQUENCY(IF(A2:A1000<>"",MATCH(A2:A1000,A2:A1000,0)),ROW(A2:A1000)-ROW(A2)+1)>0))

What version of Excel are you using?
Please update your account details to show this, as it affects which functions you can use.
 
Upvote 0
Solution
How about
Excel Formula:
=SUMPRODUCT(--(FREQUENCY(IF(A2:A1000<>"",MATCH(A2:A1000,A2:A1000,0)),ROW(A2:A1000)-ROW(A2)+1)>0))

What version of Excel are you using?
Please update your account details to show this, as it affects which functions you can use.
It's Office 365
 
Upvote 0
How about
Excel Formula:
=SUMPRODUCT(--(FREQUENCY(IF(A2:A1000<>"",MATCH(A2:A1000,A2:A1000,0)),ROW(A2:A1000)-ROW(A2)+1)>0))

What version of Excel are you using?
Please update your account details to show this, as it affects which functions you can use.
This formula worked, thanks!!!
 
Upvote 0
You're welcome & thanks for the feedback.
However as you are using 365 I would go with Peter's suggestion.
 
Upvote 0
Please add this to your profile as requested in your other thread.

Try
Excel Formula:
=ROWS(UNIQUE(FILTER(A2:A1000,A2:A1000<>"")))
Updated my profile as you suggested, thanks.

For some reason the formula you provided did not work, it is giving me a much higher number than is. Formula given by Fluff worked though.
Excel Formula:
=SUMPRODUCT(--(FREQUENCY(IF(A2:A1000<>"",MATCH(A2:A1000,A2:A1000,0)),ROW(A2:A1000)-ROW(A2)+1)>0))
 
Upvote 0
They both give the same result for me.
+Fluff v2.xlsm
ABCD
1CountyFrequencyFilter
2Cumbria1010
3Shropshire
4West Yorkshire
5County Durham
6Staffordshire
7Northumberland
8South Yorkshire
9West Yorkshire
10West Yorkshire
11Lancashire
12West Yorkshire
13Devon
14County Durham
15North Yorkshire
16North Yorkshire
17Staffordshire
18West Yorkshire
19West Yorkshire
20County Durham
21Cumbria
22Lancashire
23West Yorkshire
24West Yorkshire
25West Yorkshire
26
Main
Cell Formulas
RangeFormula
C2C2=SUMPRODUCT(--(FREQUENCY(IF(A2:A1000<>"",MATCH(A2:A1000,A2:A1000,0)),ROW(A2:A1000)-ROW(A2)+1)>0))
D2D2=ROWS(UNIQUE(FILTER(A2:A1000,A2:A1000<>"")))
 
Upvote 0
They both give the same result for me.
+Fluff v2.xlsm
ABCD
1CountyFrequencyFilter
2Cumbria1010
3Shropshire
4West Yorkshire
5County Durham
6Staffordshire
7Northumberland
8South Yorkshire
9West Yorkshire
10West Yorkshire
11Lancashire
12West Yorkshire
13Devon
14County Durham
15North Yorkshire
16North Yorkshire
17Staffordshire
18West Yorkshire
19West Yorkshire
20County Durham
21Cumbria
22Lancashire
23West Yorkshire
24West Yorkshire
25West Yorkshire
26
Main
Cell Formulas
RangeFormula
C2C2=SUMPRODUCT(--(FREQUENCY(IF(A2:A1000<>"",MATCH(A2:A1000,A2:A1000,0)),ROW(A2:A1000)-ROW(A2)+1)>0))
D2D2=ROWS(UNIQUE(FILTER(A2:A1000,A2:A1000<>"")))
You are right, sorry about that. I had a typo in my transferred formula (need more :coffee:). Both the formulas work great, thanks for taking the time :)(y)
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,046
Messages
6,122,852
Members
449,096
Latest member
Erald

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