The tutorial looks at how to leverage the new dynamic array functions to count unique values in Excel: formula to count unique entries in a column, with multiple criteria, ignoring blanks, and more.
A couple of years ago, we discussed various ways to count unique and distinct values in Excel. But like any other software program, Microsoft Excel continuously evolves, and new features appear with almost every release. Today, we will look at how counting unique values in Excel can be done with the recently introduced dynamic array functions. If you have not used any of these functions yet, you will be amazed to see how much simpler the formulas become in terms of building and convenience to use.
Note. All the formulas discussed in this tutorial rely on the UNIQUE function, which is only available in Excel 365 and Excel 2021. If you are using Excel 2019, Excel 2016 or earlier, please check out this article for solutions.
Count unique values in column
The easiest way to count unique values in a column is to use the UNIQUE function together with the COUNTA function:
The formula works with this simple logic: UNIQUE returns an array of unique entries, and COUNTA counts all the elements of the array.
As an example, let's count unique names in the range B2:B10:
=COUNTA(UNIQUE(B2:B10))
The formula tells us that there are 5 different names in the winners list:
Tip. In this example, we count unique text values, but you can use this formula for other data types too including numbers, dates, times, etc.
Count unique values that occur just once
In the previous example, we counted all the different (distinct) entries in a column. This time, we want to know the number of unique records that occur only once. To have it done, build your formula in this way:
To get a list of one-time occurrences, set the 3rd argument of UNIQUE to TRUE:
UNIQUE(B2:B10,,TRUE))
To count the unique one-time occurrences, nest UNIQUE in the ROW function:
ROWS(UNIQUE(B2:B10,,TRUE))
Please note that COUNTA won't work in this case because it counts all non-blank cells, including error values. So, if no results are found, UNIQUE would return an error, and COUNTA would count it as 1, which is wrong!
To handle possible errors, wrap the IFERROR function around your formula and instruct it to output 0 if any error occurs:
=IFERROR(ROWS(UNIQUE(B2:B10,,TRUE)), 0)
As the result, you get a count based on the database concept of unique:
Count unique rows in Excel
Now that you know how to count unique cells in a column, any idea on how to find the number of unique rows?
Here's the solution:
The trick is to "feed" the entire range to UNIQUE so that it finds the unique combinations of values in multiple columns. After that, you simply enclose the formula in the ROWS function to calculate the number of rows.
For example, to count the unique rows in the range A2:C10, we use this formula:
=ROWS(UNIQUE(A2:C10))
Count unique entries ignoring blank cells
To count unique values in Excel ignoring blanks, employ the FILTER function to filter out empty cells, and then warp it in the already familiar COUNTA UNIQUE formula:
With the source data in B2:B11, the formula takes this form:
=COUNTA(UNIQUE(FILTER(B2:B11, B2:B11<>"")))
The screenshot below shows the result:
Count unique values with criteria
To extract unique values based on certain criteria, you again use the UNIQUE and FILTER functions together as explained in this example. And then, you use the ROWS function to count unique entries and IFERROR to trap all kinds of errors and replace them with 0:
For example, to find how many different winners there are in a specific sport, use this formula:
=IFERROR(ROWS(UNIQUE(FILTER(A2:A10,B2:B10=E1))), 0)
Where A2:A10 is a range to search for unique names (range), B2:B10 are the sports in which the winners compete (criteria_range), and E1 is the sport of interest (criteria).
Count unique values with multiple criteria
The formula for counting unique values based on multiple criteria is pretty much similar to the above example, though the criteria are constructed a bit differently:
Those who are curious to know the inner mechanics, can find the explanation of the formula's logic here: Find unique values based on multiple criteria.
In this example, we are going to find out how many different winners there are in a specific sport in F1 (criteria 1) and under the age in F2 (criteria 2). For this, we are using this formula:
=IFERROR(ROWS(UNIQUE(FILTER(A2:A10, (B2:B10=F1) * (C2:C10<F2)))), 0)
Where A2:B10 is the list of names (range), C2:C10 are sports (criteria_range 1) and D2:D10 are ages (criteria_range 2).
That's how to count unique values in Excel with the new dynamic array functions. I am sure you appreciate how much simpler all the solutions become. Anyway, thank you for reading and hope to see you on our blog next week!
Practice workbook for download
Count unique values formula examples (.xlsx file)
208 comments
Hello All,
How do I find the total sum of repeated count in a column? E.g If I have A1, A2, A3, A3, A2, B2, B2. I want the sum of repeated count to be 6
Hello!
I recommend reading this guide: Count the total number of duplicates in a column.
Feel free to stop by our comments anytime.
Hi, I need help please!
Im trying to calculate how many unique delivery numbers I have that are
A. under 30 days overdue
B. inbetween 30 and 90 days overdue
C. over 90 days over due.
I've just tried =IFERROR(ROWS(UNIQUE(FILTER(E:E,C:C<31))),0) but it's counting ones that are over 90 days overdue too. is there something else I need to do to stop this?
Hello!
Give an example of the data that is written in column C. Is it a date, number, or text?
Hi there,
Thank you for the article - really helpful. I'm looking for a way to list the unique values across an entire table or array. For example my table values look like:
Apple Pear Orange
Banana Lemon Apple
Orange Banana Pineapple
Berry Lemon Apple
I want to generate the list of unique values only across the table:
Apple
Pear
Orange
Banana
Lemon
Pineapple
Berry
Any advice on the best way to extract this would be much appreciated!
Hello!
How to extract unique values from multiple columns you can read in this comment.
I hope my advice will help you solve your task.
Hi. How can I count unique values under a column? I'm trying to see how much customer feedbacks there are. Let's say I want to know how many people said excellent or professional.
Column F
1. very professional and the service provided was excellent
2. customer service was great
3. professional
4. my problem got resolved
5. the woman I spoke with was excellent and professional
Hello!
Your question has nothing to do with counting unique values. I recommend reading this guide: Excel formulas to count cells with text.
You can use this formula:
=SUM(--ISNUMBER(SEARCH($K$1,A1:A5,1)))
where K1="professional" or another desired word.
Hi Kenma,
You can also use a COUNTIF formula with wildcards like this:
=COUNTIF(A1:A5, "*professional*")
For more information, please see Count if cell contains text (partial match).
Thank you for your help!
Hi there
I have a dataset with an ID number in column A and a response of yes or no to 2 questions in columns B & C. I am trying to get an accurate chart of the results, where i take a unique count of ID Number for each of the 3 outcomes to the 2 questions, YES & YES = Outcome 1, YES & NO = Outcome 2 and NO & YES is outcome 3.
My problem is that ID number 1 below has returned a different response to Q1 in the first row than it did in row 2. So my results return a value for ID number 1 in outcome 1 and also a value for outcome 3. Where an ID number answers YES in Q1 it should always trump any additional response of NO. So the unique count for Outcome 3 should not include ID Number 1.
I can do it manually and find the duplicates and remove the incorrect records, but this is a long process as the dataset is quite large. I need to automate this process in some way. Any help is most appreciated.
ID Number Q1 Q2
1 YES YES
1 NO YES
2 YES YES
2 YES YES
3 NO YES
Hello!
If I got you right, the formula below will help you with your task:
=IF(IF(COUNTIFS($A$2:$A$10,A2,$B$2:$B$10,"Yes")>0,"Yes","No") & IF(COUNTIFS($A$2:$A$10,A2,$C$2:$C$10,"Yes")>0,"Yes","No")="YesYes",1, IF(IF(COUNTIFS($A$2:$A$10,A2,$B$2:$B$10,"Yes")>0,"Yes","No") & IF(COUNTIFS($A$2:$A$10,A2,$C$2:$C$10,"Yes")>0,"Yes","No")="YesNo",2,3))
I hope I answered your question. If something is still unclear, please feel free to ask.
Hii Sir
can u please clear it
if use one row bt different words and finally i want particular word count so what formula i can use?
Hi!
Your question is not clear. Explain in more detail.
I have a spreadsheet of census information which contains the columns "Surname", "Given Name", and "Occupation". Frequently the data in each of these columns is the same (people with the same occupation, people who have the same surname, or given name). I want to create a formula which will identify each unique value in the column, and then count the number of instances of that unique item. So for example, I want to count the number of people who have a specific occupation. Or the number of people who have a specific surname, etc. I am using this formula to find and sort the unique values in the column, and it is working fine:
=SORT(UNIQUE(J2:J3135))
What I'd like to add to it is " (nn)" at the end of the formula shown so that the output (for the occupation field) would look like this (where these are the unique values identified by the above formula in the J2:J3135 range):
Apprentice (14)
Artist (1)
Blacksmith (4)
Bookkeeper (2)
Clergyman (3)
...etc.
So far I am not having much luck adding the counting part of this.
Many thanks in advance.
Hello!
You can learn more about counting unique values with criteria in Excel in this article on our blog.
Hello Alexander,
I am working on a spreadsheet that is live, and ever changing. The question asked above is the most similar to what I am attempting to do. The two column titles are "Job Number" and "Company". Here is an example:
1 Company A
2 Company A
3 Company B
4 Company C
5 Company D
6 Company D
7 Company E
The UNIQUE function I am using is working correctly. Each Rep generally has 50 assigned "Job Numbers". So, In Cell C1, I enter the unique formula, and it outputs correctly:
Company A
Company B
Company C
Company D
Company E
What I would now like to do, is link the output in Column C, with a Total in column D. With the end result being:
Company A | 2
Company B | 1
Company C | 1
Company D | 2
Company E | 1
From the article that you linked above, I see how you do this. However, as jobs complete, that column is removed. This is why I would like to tie Column C and Column D. If Company B is completed and removed, This is what the data then looks like:
Company A | 2
Company C | REF!
Company D | 1
Company E | 2
| 1
I really hope this makes sense haha!
However, as jobs complete, that ROW*** is removed. I apologize.
Hello!
The #REF error appears if you delete the cell that the formula refers to. Try using the IFERROR function.
=COUNTIFS($J:$J,"name",$N:$N,"name") . one more column need to take and need distinct count from that . please help
Dear Ablebits,
I am trying to find the number of unique agents who sold in 1 week and didn't sell in the next week. Like in the table below, Agent 3 and 4 sold in week 1 and didn't sell in week 2.
Date Week Agent Name Sales
1/1/21 1 Agent 1 1
1/1/21 1 Agent 2 1
1/1/21 1 Agent 3 1
2/1/21 1 Agent 1 1
2/1/21 1 Agent 2 1
2/1/21 1 Agent 3 1
2/1/21 1 Agent 4 1
3/1/21 1 Agent 1 1
3/1/21 1 Agent 2 1
3/1/21 1 Agent 3 1
9/1/21 2 Agent 1 1
9/1/21 2 Agent 2 1
9/1/21 2 Agent 5 1
10/1/21 2 Agent 1 1
10/1/21 2 Agent 2 1
10/1/21 2 Agent 5 1
Using the unique count formula, I have tried using the formula below but I have been getting the calc error -
FILTER(Daily_sales_data!O2:O10839,(Daily_sales_data!K2:K10839=E2-1)*(Daily_sales_data!K2:K10839=(E2-2)))
where;
Daily_sales_data!O2:O10839 - similar to Agent Name column above
Daily_sales_data!K2:K10839 - similar to Week column above
E2 = Week 3, so E2-1= Week 2 and E2-2= Week 1
Can you help me know what I am doing wrong?
Hello!
Your data is written in A2:D17 and the week number is written in E1. To calculate how many agents sold in week 1 and not sold in week 2, try the formula
=SUM((COUNTIFS(C2:C17,UNIQUE(C2:C17),B2:B17,$E$1)>0) * (COUNTIFS(C2:C17,UNIQUE(C2:C17),B2:B17,$E$1+1)=0))
Hope this is what you need.
Hi Experts,
Reaching out to seek for your kind support.
I want to count the total unique numeric value in a columns that consist of different duplicates, each value should represent"1" count
result for below column should be 6.
Column B:
1441
1441
1441
80
987
987
11
11
900
540
540
many thanks!!
Hi!
I don't understand how you got the result 6.
thank you for the answer
it answered and it didn't at the same time, topic you gave nd here is example:
=IFERROR(ROWS(UNIQUE(FILTER(D2:D6, (A2:A6=J5) * (B2:B6=K5) * (C2:C6=L5) * (F2:F6=M5)))), 0)
"J5 is 1, K5 is A, L5 is 1 and M5 is done"
here I have multiple arrays, if (zone1->area1->type1is done) it will return (3)
I want to figure out how it will return "1"?
as house no. 2 & 3 are not done completely.
house no.2 only one product is done with production & delivery the other is not.
---A-------B------C-----------D--------------E-------------F---------------G
zone l area l type l house no. l product l production l delivery
--1------- A ------1-----------1------------ z1-------- done--------- done
--1--------A ------1---------- 1------------ z2-------- done ---------done
--1------- A ------1---------- 2------------ z1-------- done--------- done
--1------- A ------1---------- 2------------ z2------------X--------------X
--1------- A ------1---------- 3------------ z1-------- done--------- done
--1------- A ------1---------- 3------------ z2-------- done -----------X
Hello!
The line "–1 ——- A ——1 ———- 2 ———— z1 ——– done ——— done” means that house 2 is done.
It is necessary to change the list of criteria and add additional data to the table.
Hello Alexander,
hope you are well, I need help to make a formula to count unique value with multiple criteria, for example:
count how many houses in (criteria1)zone 1,(C2)area A, (C3) type 1, done production,
hence: if production is "done" for (1/2/3) products in a house, then it count as 1.
when I use sum frequency with multiple criteria it gives me error "too few conditions".
A B C D E F G
zone l area l type l house no. l product l production l delivery
1 A 1 1 z1 done done
1 A 1 1 z2 done done
1 A 1 2 z1 done done
1 A 1 2 z2 done done
1 A 1 3 z1 done done
1 A 1 3 z2 done done
1 A 2 1 z1 done done
1 A 2 1 z2 done done
1 A 2 1 z3 done done
note: zones(1,2,3,4) are not duplicates
but for each zone -> area(1,2,3) type(A,B,C..), house(1,2,3...), products(z1,z2) have duplicates.
Hello!
You can find the examples and detailed instructions here: Count unique values with multiple criteria.
I hope I answered your question. If something is still unclear, please feel free to ask.
The =UNIQUE formula does not exist. It only gave me #NAME?
How did you get that? or is there any other formula same results it show.
Hello, how do you get a distinct list across multiple workbooks or worksheets?
Also, how do you combine VLOOKUP and index match.
let say I have existing list and I want to add list from another workbooks but that workbook is continuously adding up a list. been trying different formulas but it's all not working or something is missing on the formula.
Hello!
Please have a look at this article — VLOOKUP across multiple sheets in Excel with examples.
Hello!
I recommend reading this guide: How to get a list of unique and distinct values in Excel.
UNIQUE function is only available in Excel 365
Hello Ablebits Team,
I have data (text) in a column say column A with another data (also text) in column B assigned to the each data in column A. I want a formula that can count the unique occurrences of the data in column A using the data in column B as reference.
Data
Column A Column B
Leo A
Pete C
Bright B
June A
Mike C
King D
Diana D
Alice C
Bright B
Leo A
Tom B
Results
A = 2
B = 2
C = 3
D = 2
Hello!
You can find the examples and detailed instructions here: Count unique values with criteria.
This should solve your task.
Column A Column B Column C (Result)
John 12345 1
John 12345 0
John 12345 0
Peter 67890 1
Peter 67890 0
Peter 67890 0
I want only the first entry to be counted as 1 in column C and the rest duplicate entries as 0.
I want result in single Column C without introducing new column.
I tried doing concatenate but not working can u please help.
=IF(COUNTIF($A$2:A2,A2)=1,1,IF(COUNTIF($D$2:D2,D2)=1,1,"-")) - Working but the Name if repeats with different number it not counting as 1
=IF(AND(COUNTIF($A$2:A2,A2),COUNTIF($D$2:D2,D2)=1),1,"-") - Working but the Name if repeats with different number it not counting as 1
Column A Column B Column C (Result)
John 12345 1
John 12345 0
John 12345 0
Peter 67890 1
Peter 67890 0
Peter 67890 0
John 005002 1
John 12345 0
Peter 45678 1
Peter 67890 0
Hi Alex,
In a column A i have many duplicate or repeated entries i want only the first entry to be counted as 1 in column B and the rest duplicate entries as 0. can u please help me.
Example
Column A Column B
12345 1
12345 0
23456 1
23456 0
12345 0
23456 0
Hello!
Please use the following formula
=IF(COUNTIF($A$1:A1,A1)=1,1,0)
You can learn more about COUNTIF function in this article.
Hi Alex,
Thank you so much Alex,
there is 1 more problem Can u please also help me for the below
Column A Column B Column C (Result)
John 12345
John 12345
John 12345
Peter 67890
Peter 67890
Peter 67890
I want only the first entry to be counted as 1 in column B and the rest duplicate entries as 0.
I want result in single Column C without introducing new column.
I tried doing concatenate but not working can u please help.
Hi!
Add another condition and use the COUNTIFS function:
=IF(COUNTIFS($A$1:A1,A1,$B$1:B1,B1)=1,1,0)
Thank you so much
Hi Alex,
I have successfully applied the UNIQUE function, but I want to see how many times all unique (distinct) inputs were present in the original column. For example:
A
1
1
2
The UNIQUE formula would give me: 1 and 2. In addition I want to see how many times the 1 and the 2 values were present in column A. Is this possible?
Thanks, Daniel
Hello!
Here is the article that may be helpful to you: Excel COUNTIF examples.
Hi,
I am looking for a method of how to return a list of cells and count with a partial match. I have used the formula below for returns with cells for a complete match.
=IFERROR(INDEX($A$2:$A$115, MATCH(0, IF($C$2:$C$115="monitor", COUNTIF($H$6:$H6, $A$2:$A$115), ""), 0)),"")
I have used the COUNTIFS function to list the count for the partial matches but it is not replicating the same outcome with partial matches - is this possible?
Thanks, Tom
Hello!
To count the number of partial matches of the word "monitor" in a range, use a formula like this:
=SUM(--(ISNUMBER(SEARCH("monitor",B1:B25,1))))
I hope this will help.
Hi Alex,
Apologies I forgot to mention that the list would be pulling the data from adjacent cells and then populating the lists, i.e. column A has variables and column B has comments.
- The formula I used in the opening statement pulls from a complete match
- The formula I need would be with a partial match
I have sent an email to support address with the workbook if it makes more sense!
Thanks, Tom
I am trying to count unique value with criteria. The criteria are to recognize the word starting with letter A in the second column. I changed the function FIND by SEARCH to use the wildcat but it is not working, maybe you can advise. I
IFERROR(ROWS(UNIQUE(FILTER(G2:G2367,ISNUMBER(SEARCH("*A*",H2:H2367,1))))), 0)
Hello!
Use a formula like this:
=ROWS(UNIQUE(FILTER(A2:A10, IFERROR(SEARCH("A",B2:B10,1)=1,FALSE))))
I hope it’ll be helpful.
I have many columns where each one has different dates
For example Column A
Box A1 is 02/24/2021
Box A2 is 02/25/2021
Box A3 is 02/26/2021
Box A2 is 02/24/2021
I should Know the date 24 how many times is found in this Column and put it in a Box and Multiply it By 5$
So: IF Column A has let's say 3 times (02/24/2021) that means 3 x 5$ should be equal to 15$
How Can I do this???
Hi,
To count how many times a value appears in column A, use the COUNTIF function.
=COUNTIF(A1:A100,D1)
where D1 -- 02/24/2021
I hope I answered your question. If something is still unclear, please feel free to ask.
Hello there I need a favor.
I need someone to help me to put a formula in a excel
I use the 2016 Version
can anyone help me?
Hi,
For me to be able to help you better, please describe your task in more detail. Please specify what you were trying to find, what formula you used and what problem or error occurred. Give an example of the source data and the expected result.
It’ll help me understand it better and find a solution for you.
Hi there, thank you for this very helpful tutorial! I've created the below formula based on your tips:
=IFERROR(ROWS(UNIQUE(FILTER('All Session Data'!$G:$G,('All Session Data'!B:B=EN1)*('All Session Data'!C:C=EN2)*('All Session Data'!I:I=EN4)*('All Session Data'!R:R=EN9)*('All Session Data'!T:T=EN8)))),0)
The formula is supposed to count all unique values in column G based on the 5 criteria I've listed. I'm getting a 0 for the result. I'm working with 24,500 rows in Google Sheets. Any suggestions for a solution?
Hi
I have three collums with similar values, the goal is to find the values occuring the most.
I want to find the unique values in the two/three collumns and use a countif statement. However, whenever i use unique on more than one collumn its registered as unique rows rather than analysing the individual cells - how is this mitigated?
Best Regards
Jens
Hello!
Your first phrase contradicts the second phrase. Do you want to find the most common values or unique values?
Based on your description, it is hard to completely understand your task. I am assuming you want to extract unique values from cells of multiple columns.
However, I’ll try to guess and offer you the following array formula:
=INDIRECT(TEXT(MIN(IF(($A$2:$C$9<>"") * (COUNTIF($E$1:E1,$A$2:$C$9)=0), ROW($2:$9)*100+COLUMN($A:$C),7^8)),"R0C00"),)&""
Assuming your values are in the range A2:C9, enter the formula in cell E2.
In the above formula, A2:C9 indicates the range of cells from which you want to extract unique values.
E1 is the first cell in the column where you want to place the result.
$2:$9 is the rows containing the cells you want to use.
$A:$C indicates that these columns contain the cells you want to use. Please change them to your own.
Press Shift + Ctrl + Enter and then drag the fill handle to extract unique values until blank cells appear.
Hi,
I have data, let's say A to F, A to E is the criteria and i need to count distinct or unique from column F with criteria from A to E, but all i got is not how much distinct counts, it's only count how much times the duplicate is. Can you help me ?
Hello!
Please check out this article to learn how to count unique values with multiple criteria.
I hope it’ll be helpful. If something is still unclear, please feel free to ask.
Hi, thank you for your feedback.
I already tried that way but i think i have different data so i'm a bit confused where to put. Refer to your link, data has repetition, while i already deleted duplicate ones so it's unique. Can i still use that formulas and put it in C2 ?
Hi,
Unfortunately, without seeing your data it is impossible to give you advice.
Could you please describe your task in more detail and send us a small sample workbook with the source data and expected result to support@ablebits.com? Please shorten your tables to 10-20 rows/columns and include the link to your blog comment.
We'll look into your task and try to help.
I have data which records in the Cell the year the equipment is being replaced. I have in another cell the cost of all equipment purchased. I would like excel to give me the total cost of equipment replacement in each of the following 5 years. Dates have been setup to have a total after excel searches the year and adds the amount. Could you assist please.
Hello!
I’m sorry but your task is not entirely clear to me.
Please describe your problem in more detail. Include an example of the source data and the result you want to get. It’ll help me understand your request better and find a solution for you.
I have a formula I use but this one does not count distinct numbers
=IF((COUNTIFS(Data!$J:$J,A8,Data!$I:$I,'Staff Enc'!$B$4))=0,"",(COUNTIFS(Data!$J:$J,A8,Data!$I:$I,'Staff Enc'!$B$4)))
Does anyone have a suggestion on how to do something similar but count distinct numbers?
I can send a sample report of how the formula works for me. Don't see were I could post it though.
Hi,
I'm sorry, it is not very clear what result you want to get. Could you please describe your task in more detail and send us a small sample workbook with the source data and expected result to support@ablebits.com? Please shorten your tables to 10-20 rows/columns and include the link to your blog comment.
We'll look into your task and try to help.
Thanks, your "Count unique values with multiple criteria" section worked a treat!
Hi all,
Trying to find a formula for a stock portfolio and it seems i struggle a lot.
I have a DB of purchases and sales in one tab (column with portoflio names - 5 and column with the ticker) and a summary page where i have all stocks and their performances with eventual rebalancing actions to be taken.
What I want to make sure is that the number of stocks reported in the summary page are the unique number of stocks i have in the db tab (aim is to get a warn if i didn't include a new bought or sold stock in the summary page as rebalancing may be wrong
Condition 1: Unique stock counts (number of - in the DB i have more purchases of the same stock)
Condition 2: Count of Unique stock number among 5 different portfolios.
I hope i clarified it and thanks in advance!
count unique values with the below data
Sales Person Items Account
A X XYZ
A X XYZ
A Y ABC
B X PQR
C Z MNL
C Y HGF
D X MTR
D Y GTR
Hello!
I hope you have studied the recommendations in the tutorial above. It contains answers to your question. If you describe your problem in detail, I will try to help you.
Hello,
Im trying to count all cells with unique values within a column range (K2:K101) excluding any cells with value 0.
I believe the formula should look something like =COUNTA(UNIQUE(FILTER(K2:K101, K2:K101"0"))) however this consistently gives me incorrect results.
Do you have suggestions?
Hello!
If I got you right, the formula below will help you with your task:
=COUNTA(UNIQUE(FILTER(K2:K101, K2:K101<>0)))
I hope my advice will help you solve your task.
I want to detect if there are multiple offer types listed in column F so I basically want to detect all unique cells in column F containing the word "offer" (unique in the sense that if some text with "offer" occurs multiple times it should only be considered once). I experimented based on your article and came up with this which worked:
=SUM(--ISNUMBER(SEARCH("offer",UNIQUE($F:$F))))
Is it possible to do something similar but across multiple worksheets? Doing this didn't work:
=SUM(--ISNUMBER(SEARCH("offer",UNIQUE('Sheet1:Sheet3'!$F:$F))))
Thanks!
Hello!
If I understand your task correctly, the following formula should work for you:
=IFERROR(ROWS(UNIQUE(FILTER(F:F, ISNUMBER(FIND("offer",F:F,1))))),0)
I hope it’ll be helpful.
Hello, I am hoping you can help me with the below.
If column C within my data matches the date I am looking for I would like to count the unique text values within column G.
I have tried various options using a google search. If you could send me a simplified explanation that would be great.
Thank you.
Hello!
Unfortunately, without seeing your data it is difficult to give you any advice.
Date matching can be checked using the IF function. If the condition is met, use the unique values formula from the section above.
Please describe your problem in more detail. It’ll help me understand it better and find a solution for you.
Hi,
I have duplicate Numeric Data in Column A, against the cell B with a different unique Names and want to unique count in column C with every unique Name.
Please anyone guide me...
Hi! Is there a way to list (and keep updated) unique values from multiple worksheets? EG: I have sales report in tables in sheets per month (Jan, Feb, Etc). I would like to list unique values (EG: Client) across all active sheets. Thanks!
Hi Experts,
Can you please help me, I am not the best at Excel but I try!
I need to find a simple way of counting the unique customer count against a particular Salesman. I can get the total unique values no problem and if I split down the Salesman that is fine also but I would like one formula rather than splitting the data every time i need to do this report!
Help! I'm using O365
you can use Flash fill or Power Query
As usual, your tutorial gets directly to the point in a friendly manner. I encourage everyone to follow your tutorials 'cause they present the steps needed to accomplish a certain task in Excel in an easy way.
Keep up the great work, and many thanks for the professional work you spread around with your tutorials!
Dear Dr. Choueiri,
Thank you very much for your feedback! I am happy to hear you had a positive experience with our tutorials. We will do our best to keep up and (hopefully!) improve.
Hi ,
I need help with count distinct in the below table-
Variant Subcat CustomerCode CustomerName ProductName Jan Feb
CREAM CREAM 6079 AL AHLI S/M CHOCOLATE CREAM 11105026 21 5
CREAM CREAM 6079 AL AHLI S/M MANGO CREAM 11105029 21
CREAM CREAM 6079 AL AHLI S/M ORANGE CREAM 11105028 21 4
CREAM CREAM 99 AL DHAFRA SM ORANGE CREAM 11105028 21
CREAM PROMO 99 AL DHAFRA SM CREAM BISC 11205001 269 30
CREAM CREAM 7935 AL DOURIZ CHOCOLATE CREAM 11105026 21
CREAM CREAM 7935 AL DOURIZ MANGO CREAM 11105029 22 4
CREAM CREAM 4900 AL MADINA HYPERMARKET MANGO CREAM 11105029 21
CREAM CREAM 4900 AL MADINA HYPERMARKET ORANGE CREAM 11105028 21
CREAM CREAM No of customers who purchased Variant Cream 4 3
CREAM PROMO 1 1
I need to count the no of customers who purchased cream under each month , irrespective of the flavor.
In the table , no of people who purchased cream was Jan - 4 , feb -3
Similarly people who purchased cream promo was Jan =1 and Feb =1.
Countif function counts all the product names as well .
Hello!
If the Jan and Feb columns are the numbers of buyers, then you can use the SUMIFS function to find the sum for those columns with certain conditions.
I hope it’ll be helpful.
Why if I put this formula
=IFERROR(ROWS(UNIQUE(FILTER(C2:C210,J2:J210=J2))), 0), it get me some value
if I increase the range from 210 to for example 400... It gives me 0 as result?
thanks
Hello!
As my personal experience shows, the UNIQUE function does not work correctly with large data sets. It returns 0, as you did.
Oh, that's great; I'm working with 66,000 rows and for hours cannot figure out why I get zero's.
At least I can move on after reading this comment, thanks.
Hi,
Your formulas an explanantions are very helpful thanks! I am struggling with getting the correct results and I'm not sure where the issue is. This is the formula I'm using, and it's giving me a reulst of 0 for all...
=IFERROR(ROWS(UNIQUE(FILTER(Table_SDCdata[Site], (Table_SDCdata[Format]=[@Format]) * (Table_SDCdata[Region]=[@Region])))), 0)
Just for the data size example: Main table I'm counting and filtering has 37 columns and 140 500 rows.
So it's suppose to count the unique 'Site' values in the Main table (becuase there are many duplicates) if the 'Region' and 'Format' matches that in the current table.
I used "=COUNTA(UNIQUE(FILTER(" before but it was giving a value of "1" for everything if I use it on big data sets, for smaller ones it works. From what I read online "COUNTA" doesn't work well with big data sets, so I have to find an alternative. Any reason as to why it's not working? Will it also be because of the data size?
Hello!
Unfortunately, without seeing your data it is impossible to give you advice.
I'm sorry, it is not very clear what result you want to get. Could you please describe your task in more detail and send us a small sample workbook with the source data and expected result to support@ablebits.com? Please include the link to your blog comment.
We'll look into your task and try to help.
Hi,
Thank you in advance for the help: I've emailed the sample file as requested.
What I'm trying to achieve is the following: Count all the unique 'Site' codes in the Master table, if the 'Region' and 'Format' matches that from the template table. There are many duplicates in the Masterfile for each site that matches the region and format, therefore I only want to count unique once. A small example (in case anyone else reads the post for future):
MASTER TEMPLATE
Format Region Site Format Region Count
Corp EC EC1 Corp EC 2 (This would be EC1 and EC2)
Corp WC WC1 Fran EC 1
Fran EC EF1 Exp EC 1
Exp EC EE1 Fran EC 1
Corp EC EC1 Fran EC 1
Fran WC WF1 Corp EC 2
Corp EC EC2
Hello!
Your formula is working correctly. However, Excel does not work correctly with so much data. If you replace your formula with
=IFERROR(ROWS(UNIQUE(FILTER($B$2:$B$1000, ($A$2:$A$1000=A2) * ($D$2:$D$1000=D2)))), 0)
then it counts the number of unique values correctly.
An alternative option for counting unique values by 2 conditions is
=SUMPRODUCT((($A$2:$A$10000=A2) * ($D$2:$D$10000=D2)) / COUNTIFS($A$2:$A$10000, $A$2:$A$10000, $D$2:$D$10000, $D$2:$D$10000, $B$2:$B$10000, $B$2:$B$10000))
This formula also works correctly, but if you increase the range to 100,000 rows, it returns 0.
Hi,
I have a sheet where there are multiple rows for a given text in a column, i need to pull data if there is only one unique row , if there is more than 1 row then need to display the number of rows
Hello!
If I understand your task correctly, the following formula should work for you:
=IF(COUNTA(UNIQUE(A2:A10))>1,COUNTA(UNIQUE(A2:A10)),A2)
I hope this will help
is there any way to count the unique value based on a text string in another column ?
In the above example, count the unique values , if the other column contain "ball" ( basketball /Volleyball )
Hello!
If I understand your task correctly, the following formula should work for you:
=IFERROR(ROWS(UNIQUE(FILTER(A2:A10,ISNUMBER(FIND("ball",B2:B10,1))))), 0)
I hope this will help
Hello, I'm trying to count unique individuals whose work location(s) are Ashburn (Column E) which could be depicted as 123 main st., Ashburn VA. An individual (Column A) can work at multiple Ashburn locations but I am only interested in counting them once. As an example, there are nine people working in Ashburn locations, but there are only three unique individuals working in Ashburn. I've looked at tons of examples but I simply can't get any of the formulas to work. Any ideas?
Hello!
I hope you have studied the recommendations in the above tutorial?
I recommend reading this section above on calculating unique values by condition.
Thank you Alexander, I am having trouble with the criteria data (E1) in your example. I am trying to use wild cards to capture multiple Ashburn locations, Ashburn 1, Ashburn 2, etc. I've used wildcarding before but I can't get this correct. Everything else in my formula works.
Hello!
If I understand your task correctly, the following formula should work for you:
=IFERROR(ROWS(UNIQUE(FILTER(A2:A10,ISNUMBER(FIND(E1,B2:B10,1))))), 0)
Cell E1 contains "Ashburn"
Hope this is what you need.
some commonly use function in excel explan with example
Hi,
Thank you for this! Can you help me how to implement an extra condition? In your example it would correspond to adding the criteria of Age greater then 16 but below 19. When adding an extra condition it just counts 0 which is not the right case. See below implementation:
=IFERROR(ROWS(UNIQUE(FILTER(A2:A10, (B2:B10=F1) * (C2:C1016))), 0)
Hi Petrine,
You just need to add each condition separately, like this:
=IFERROR(ROWS(UNIQUE(FILTER(A2:A10, (B2:B10=F1) * (C2:C10>16) * (C2:C10<19)))), 0)
Tab Unique values multiple criteria, when entering a value of 10 in F2, then E5 displays a #CALC! error message as expected, but F5 displays a value of 1 as COUNTA also calculates the cell which contains a string. Using such a formula may render incorrect results, which aren't very obvious for users, without thorough checking. Unfortunately cannot use the COUNTBLANK formula to add to the existing formula and subtract records when containing a string to come to the correct result. Any other workaround?
Hello Alfred!
Thank you for pointing out this issue! We will check all the formulas in this tutorial for "non-matched" criteria and fix the erroneous ones.
In the meantime, you can use these formulas:
E5
=IFERROR(UNIQUE(FILTER(A2:A10, (B2:B10=F1) * (C2:C10<F2))),"")
F5
=SUM(--NOT(ISERROR(UNIQUE(FILTER(A2:A10,(B2:B10=F1)*(C2:C10<F2))))))
I hope it’ll be helpful.
Hi Alfred,
Thank you very much for catching this error! And my apologies for not testing the formula when the criteria are not met. In addition to Alexander's response, I can suggest the following solution:
You can use the ROWS function to count unique entries (unlike COUNTA, it does not count error values) and IFERROR to trap all kinds of errors and replace them with 0. So, the formula in F5 would go as follows:
=IFERROR(ROWS(UNIQUE(FILTER(A2:A10, (B2:B10=F1) * (C2:C10<F2)))), 0)
We have updated this and a few other formulas in this tutorial. Thank you for helping me make this post a little better :)
Good day to Ablebits Team!
i have a column of dates with ten entries (Random future dates) for each ten different material, i wanted to have a notification that would tell me how many of those materials will expire 30 days before the dates mentioned in their respective columns. any help would do.
Hello!
If I understand your task correctly, the following formula should work for you:
=SUM(--(D1:D10<(TODAY()+30)))
Hope this is what you need.
Dear experts,
I saw an article on getting distinct values. While i understand the array distinct formula, i am not able to understand the regular distinct formula.
MATCH(0, INDEX(COUNTIF($B$1:B1, $A$2:$A$10), 0, 0), 0))
not sure why there is a index function as it always return a value of 1 instead of an array not matter what is the range of column "B". Example MATCH(0, INDEX(COUNTIF($B$1:B3, $A$2:$A$10), 0, 0), 0))
However, I tested this formula, it works. Just do not understand the rationale behind how this works.
Hello Ben!
Unfortunately, without seeing your data it hard to give you advice. You might find this article about function MATCH useful.
Dark Chocolate 25gm box 12 pcs
Dark Chocolate 20gm*24 box
White Chocolate 15gm
White Chocolate 25gm*24
Biscuits W/Marshmallow300gm
Chocolate 40gm
Can some plz help to extract the numbers before "gm", for example : 25,20,15,25,300,40
Dear Ablebits...
Please help me to fix this task
I have data in “A” column and input in “B” column and required result is in ” C” column.
I already found the result is in “E” Column. But this result needs to fix the corresponding raw of the A Column.
Data1 Data2 Required Result Formula
1 2 1 1
5 5 7
7 9 7 11
9 16 11
9 25
11 11 25
11 11 33
16 35
16 58
25 25 60
Array Formula in E2 Column is :=IFERROR(IFERROR(INDEX($A$2:$A$21, SMALL(IF(COUNTIF($B$2:$B$21,$A$2:$A$21)=0, MATCH(ROW($A$2:$A$21),ROW($A$2:$A$21)), ""), ROWS($E$2:E2))), INDEX($B$2:$B$21, SMALL(IF(COUNTIF($A$2:$A$21,$B$2:$B$21)=0, MATCH(ROW($B$2:$B$21),ROW($B$2:$B$21)), ""), ROWS($E$2:E2)-SUM((COUNTIF($B$2:$B$21, $E$2:$E2)=0)+0))))," ")
Hello!
I’m sorry but your task is not entirely clear to me. What do you want to find with your formula? Could you please describe it in more detail? Thank you!