跳到主要内容

如何计算Excel列中的唯一值或数字?

假设您在工作表的范围中有一个值列表,现在您想知道其中有多少个唯一值。 如果您一一识别并计算它们,将会浪费很多时间。 因此,在这里我将向您介绍一些解决该问题的快速技巧。

用公式计算唯一值的数量

使用高级过滤器计算唯一值的数量

使用 Kutools for Excel 计算唯一值的数量


用公式计算唯一值的数量

有一些公式可以帮助您快速计算范围内唯一值的数量。 例如,如果您的数据是数字,则您有一列范围在(A1:A10)的数字,请参见屏幕截图:

文档计数唯一值1

您可以使用以下公式,具体操作如下:

1。 输入此公式 =SUMPRODUCT(1/COUNTIF(A1:A10,A1:A10)) 变成一个空白单元格。

文档计数唯一值1

2。 然后按 输入 键,并显示唯一值的编号。 看截图:

文档计数唯一值1

Tips:1.这是另一个公式 =SUM(IF(FREQUENCY(A1:A10, A1:A10)>0,1)) 也可以帮助您。 请随意申请任何人。 以上两个公式都将计算唯一值,包括第一个重复值。

2。 如果您的工作表中有一定范围的文本,则上述公式将不起作用,您应该使用以下数组公式: =SUM(IF(FREQUENCY(IF(LEN(A1:A10)>0,MATCH(A1:A10,A1:A10,0),""), IF(LEN(A1:A10)>0,MATCH(A1:A10,A1:A10,0),""))>0,1))

文档计数唯一值1

输入公式后,然后记得按 Shift + Ctrl + 输入 键,并且已显示唯一值的数量。

文档计数唯一值1

笔记:

  • 1.范围 A1:A10 在上面的公式中是可变的,您可以根据需要更改它们。
  • 2.此公式还计算包括第一个重复项在内的唯一值。
  • 3.此公式也适用于一系列文本和数字。

使用高级过滤器计算唯一值的数量

您还可以使用“高级筛选器”从一列数据中提取唯一值并将其粘贴到新位置。 然后使用ROWS函数来计算新范围内唯一值的数量。 具体步骤如下:

1。 点击 时间 功能区中的“选项卡”,然后单击“ 高级 命令,请参见屏幕截图:

文档计数唯一值1

2. 而在 进阶筛选 对话框:

文档计数唯一值1
  • (1.)选择 复制到另一个位置 选项下 操作;
  • (2.)在 清单范围 部分,点击 文档按钮1 按钮选择您要使用的范围数据;
  • (3.)在 复制到 部分,点击 文档按钮1 按钮,指定要放入过滤后的唯一值的单元格;
  • (4.)最后检查 仅唯一记录 选项。

3。 完成设置后,单击 OK,唯一值已在新列中列出,请参见屏幕截图:

文档计数唯一值1

4。 然后在空白单元格中输入简短公式 = ROWS(E1:E8),然后按 输入 键盘上的键。 并显示唯一值的数量。

文档计数唯一值9 -2 文档计数唯一值10

使用 Kutools for Excel 计算唯一值的数量

 在这里,我将向您推荐一个有用的工具- Kutools for Excel,其 选择重复和唯一单元格 功能,您可以快速选择重复值或唯一值并计算它们的数量。

Kutools for Excel : 带有300多个便捷的Excel加载项,可以在30天内免费试用

安装后 Kutools for Excel,请执行以下步骤:

1. 选择要计算唯一值的数据范围。

2。 然后点击 库工具 > 选择 > 选择重复和唯一单元格,请参见屏幕截图:

文档计数唯一值11-11

3。 在 选择重复和唯一单元格 对话框,选择 仅唯一值 or 所有唯一(包括第一个重复项) 根据需要,您还可以通过选中 填充背景色 or 填充字体颜色 在下面 处理结果 部分,请参见屏幕截图:

文档计数唯一值12-12

4。 (1.)如果选择 仅唯一值,则将仅计算和选择唯一值。 看截图:

文档计数唯一值13-13

(2.)如果选择 所有唯一(包括第一个重复项),包括以下重复项在内的所有唯一值(包括第一个重复项)都会被计数和选择,如下所示:

文档计数唯一值14-14

单击以了解有关此“选择重复和唯一单元格”功能的更多信息。

立即下载和免费试用Excel的Kutools!


演示:使用 Kutools for Excel 计算唯一值的数量

Kutools for Excel:具有300多个方便的Excel加载项,可以在30天内免费试用,没有任何限制。 立即下载并免费试用!


相关文章:

如何在Excel中从选定范围过滤或选择唯一记录?

最佳办公生产力工具

🤖 Kutools 人工智能助手:基于以下内容彻底改变数据分析: 智能执行   |  生成代码  |  创建自定义公式  |  分析数据并生成图表  |  调用 Kutools 函数...
热门特色: 查找、突出显示或识别重复项   |  删除空白行   |  合并列或单元格而不丢失数据   |   不使用公式进行四舍五入 ...
超级查询: 多条件VLookup    多值VLookup  |   跨多个工作表的 VLookup   |   模糊查询 ....
高级下拉列表: 快速创建下拉列表   |  依赖下拉列表   |  多选下拉列表 ....
列管理器: 添加特定数量的列  |  移动列  |  切换隐藏列的可见性状态  |  比较范围和列 ...
特色功能: 网格焦点   |  设计图   |   大方程式酒吧    工作簿和工作表管理器   |  资源库 (自动文本)   |  日期选择器   |  合并工作表   |  加密/解密单元格    按列表发送电子邮件   |  超级筛选   |   特殊过滤器 (过滤粗体/斜体/删除线...)...
前 15 个工具集12 文本 工具 (添加文本, 删除字符,...)   |   50+ 图表 类型 (甘特图,...)   |   40+ 实用 公式 (根据生日计算年龄,...)   |   19 插入 工具 (插入二维码, 从路径插入图片,...)   |   12 转化 工具 (小写金额转大写, 货币兑换,...)   |   7 合并与拆分 工具 (高级组合行, 分裂细胞,...)   |   ... 和更多

使用 Kutools for Excel 增强您的 Excel 技能,体验前所未有的效率。 Kutools for Excel 提供了 300 多种高级功能来提高生产力并节省时间。  单击此处获取您最需要的功能...

产品描述


Office Tab 为 Office 带来选项卡式界面,让您的工作更加轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,发布者,Access,Visio和Project。
  • 在同一窗口的新选项卡中而不是在新窗口中打开并创建多个文档。
  • 每天将您的工作效率提高50%,并减少数百次鼠标单击!
Comments (18)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
With the new UNIQUE function in Excel 365: COUNTA(UNIQUE(interval)).
This comment was minimized by the moderator on the site
tying to know the values of unique customer for different products, for ex: there are 100 customers, wanted to know out of those how many are unique customers who buy only those products. Likewise: total sales of products = 100 apple = 40 orange = 60 how to find out customers who have brought only oranges and apples?
This comment was minimized by the moderator on the site
in this formula, =SUM(IF(FREQUENCY(MATCH(B2:B10,B2:B10,0),MATCH(B2:B10,B2:B10,0))>0,1)) can i add another "if"? for example i want count the range of unique text in B2:B150 if C2:C150=1 ??? can i?
This comment was minimized by the moderator on the site
How would you seperate unique values in a cell? ie. #2,#2,#3 I only want the #2 to appear once?
This comment was minimized by the moderator on the site
no these formulas are not sufficient, in actual my problem is little bit big, there are lots of column in my sheet, with the name of store id and store name and months in three column respectively and there is repetition of store name in every month a no of time, i have to calculate the unique no of the store name with respect to month. please suggest me the exact formula accordingly.
This comment was minimized by the moderator on the site
Order Rep Status Product Order Value A1 John Close Apple $1 A1 John Close Pear $1.50 A2 John Open Orange $0.50 A3 John Close Grape $3.00 A2 John Open Apple $1 A4 John Close Orange $0.50 A5 Mary Close Apple $1 A6 Peter Close Grape $3.00 Appreciate your advice on this... I am trying to count the unique number of order # (first column), where the rep is John and the order status is closed. the result to achieve is 3 unique orders (A1, A3 and A4). But if i do a countifs function, it literally count the number of 'Close' where rep=John, and that comes back with 4. Is this possible to count unique values against multiple conditions of other columns?
This comment was minimized by the moderator on the site
Anyone know how to make the =SUM(IF(FREQUENCY(A1:A10, A1:A10)>0,1)) formula work to count the number of unique fields for a series of intervals? For example, I want to be able to find out the number of unique entries for each day. My data is structures as ID numbers in Column A, Dates in column B. The data is sorted by the date column. Any help would be very very much appreciated!
This comment was minimized by the moderator on the site
Your formula works a treat and allows me to see the number of unique clients that I have in total (i.e. from all my sales people combined). I am struggling however, to update the formula so that it would allow me to see the number of unique clients an individual sales person would have. Any ideas?
This comment was minimized by the moderator on the site
=SUMPRODUCT(1/COUNTIF(A1:A10,A1:A10))when you are selecting the range make sure that the cells should not be blank.
This comment was minimized by the moderator on the site
Hi, Thank you for your help regarding the duplicates but I'd like to modify your formula =SUM(IF(FREQUENCY(A2:A800, A2:A800)>0,1)) and add this condition (assuming that all the cells are numbers) to count only between 402 to 460 and it goes on to 502 to 560; 602 to 660 (1 formula per range) would it be possible? Thank you very much!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations