提示:其它语言是由 Google 机器翻译的。 你可以访问 English 版本。
登录
x
or
x
x
马上登记
x

or

如何在Excel中分配序列号以复制或唯一的值?

如果你有一个包含一些重复的值的列表,我们有可能将序列号分配给重复值或唯一值吗? 这意味着给出重复值或唯一值的顺序,如下面的截图所示。 本文将介绍一些简单的公式来帮助您在Excel中解决此任务。

doc分配重复的唯一的1

使用公式分配序列号以重复值

使用公式将序列号分配给唯一值

Office选项卡在Office中启用选项卡式编辑和浏览,使您的工作更轻松......
Kutools for Excel - 最佳办公生产力工具将解决您的大部分Excel问题
  • 重用任何东西: 将最常用或最复杂的公式,图表和其他任何内容添加到您的收藏夹中,并在将来快速重复使用它们。
  • 超过20文本功能: 从文本字符串中提取数字; 提取或删除部分文本; 将数字和货币转换为英语单词...
  • 合并工具:多个工作簿和表格合二为一; 合并多个单元格/行/列而不丢失数据; 合并重复行和总和...
  • 拆分工具:根据价值将数据拆分为多个表格; 一个工作簿到多个Excel,PDF或CSV文件; 一列到多列......
  • 粘贴跳过 隐藏/过滤行; 数和总和 按背景颜色; 创建邮件列表和 通过Cell的价值发送电子邮件...
  • 超级过滤器: 创建高级过滤方案并应用于任何工作表; 排序 按周,日,频率等; 筛选 通过大胆,公式,评论......
  • 超过300强大的功能; 适用于Office 2007-2019和365; 支持所有语言; 在公司轻松部署; 全功能60天免费试用。

箭头蓝色右泡 使用公式分配序列号以重复值

要订购重复值,请使用以下公式:

输入这个公式: = COUNTIF($ A $ 2:A2,A2) 放到数据旁边的空白单元格中,然后将填充手柄向下拖动到要应用此公式的单元格,并根据重复值指定单元格值,请参阅截图:

doc分配重复的唯一的2


箭头蓝色右泡 使用公式将序列号分配给唯一值

要将序列号分配给唯一的值,下面的公式可能会对您有所帮助:

输入这个公式: =IF(COUNTIF(A$2:A2,A2)=1,MAX(B$1:B1)+1,VLOOKUP(A2,A$1:B1,2,0)) 放到数据旁边的空白单元格中,然后将填充手柄向下拖动到要应用此公式的单元格,并按照以下屏幕截图所示排序唯一值:

doc分配重复的唯一的3

备注:

1。 在上面的公式中, A2 单元格是否包含要分配的值, B1 是你的公式所在的上述单元格。

2。 这些公式也可以应用于排序列表中的值,并且您将会得到以下结果:

doc分配重复的唯一的4


Kutools for Excel - 最佳办公生产力工具提高80%的生产力

  • 重用: 快速插入 复杂的公式,图表 以及你以前用过的任何东西; 加密单元格 密码; 创建邮件列表 并发送电子邮件...
  • 超级方程式酒吧 (轻松编辑多行文字和公式); 阅读布局 (轻松读取和编辑大量单元格); 粘贴到过滤范围...
  • 合并单元格/行/列 不丢失数据; 分裂细胞含量; 组合重复的行/列...防止重复的细胞; 比较范围...
  • 选择复制或唯一 行; 选择空行 (所有细胞都是空的); 超级查找和模糊查找 在许多工作簿中; 随机选择......
  • 精确复制 多个单元格而不更改公式参考; 自动创建参考 多张表; 插入项目符号,复选框等等......
  • 提取文本,添加文本,按位置删除, 删除空间; 创建和打印分页小计; 在单元格内容和注释之间转换...
  • 超级过滤器 (将过滤方案保存并应用到其他工作表); 高级排序 按月/周/日,频率等; 特殊过滤器 用粗体,斜体......
  • 结合工作簿和工作表; 根据键列合并表; 将数据拆分为多个表格; 批量转换xls,xlsx和PDF...
  • 超过300强大的功能。 支持Office / Excel 2007-2019和365。 支持所有语言。 在您的企业或组织中轻松部署。 全功能60天免费试用。
kte tab 201905

Office选项卡为Office提供选项卡式界面,使您的工作更轻松

  • 在Word,Excel,PowerPoint中启用选项卡式编辑和阅读,Publisher,Access,Visio和Project。
  • 在同一窗口的新选项卡中打开并创建多个文档,而不是在新窗口中。
  • 通过50%提高您的工作效率,每天为您减少数百次鼠标点击!
官方底部
Say something here...
symbols left.
You are guest ( Sign Up? )
or post as a guest, but your post won't be published automatically.
Loading comment... The comment will be refreshed after 00:00.
  • To post as a guest, your comment is unpublished.
    YT Kong · 1 months ago
    Hello there,

    If i want the formula to have alphabet infront is it possible?

    DO123455 =A1
    DO123455 =A1
    DO223344 = A2
    DO223344 = A2
    DO567890 = A3

    Appreciate if you can assist on my problem.

    Thank you

    YT Kong
  • To post as a guest, your comment is unpublished.
    Cesar · 2 months ago
    Hi, i want some help, i need my data right this:

    A 1
    A 2
    A 3
    B 1
    B 2
    C 1
    D 1
    C 1
    C 2
    B 1
    E 1
    E 2
    A 1
    I need taht when it finds a new value starts since 1, every time. Is it posible ?
  • To post as a guest, your comment is unpublished.
    Miskin · 5 months ago
    I want serial number start from 1 when it encounter new series
    Like
    AA - 1
    BB - 1
    AA - 2
    CC -1
    DD -1
    AA - 3
    BB - 2

    Is this possible?
  • To post as a guest, your comment is unpublished.
    Eric · 8 months ago
    Is it possible to do this with power query, and not with the vlookup formula?
  • To post as a guest, your comment is unpublished.
    Alex · 1 years ago
    Is it possible to assign such serial numbers within the same cell? I have a sheet that does this using a macro, but I cannot access the macro (password protected) to see how they did it.
    Disclaimer: I have permission to access the macros, but it is an old sheet and the passwords are lost.
  • To post as a guest, your comment is unpublished.
    MIDHIN C R · 1 years ago
    hai pls help

    i have a series of data and i want this type of results
    item product sequence number
    a powder 1
    a juice 2
    b preprocess 2
    b process 3
    b jucie 1
    c powder 1
    c juice 2
    c preprocess 3
    c procss 4


    want sequence number based on item and product column
  • To post as a guest, your comment is unpublished.
    JohnHambright · 1 years ago
    CA-01.1
    CA-01.2
    CA-01.3
    CA-01.4
    CA-01.5
    CA-01.6
    CA-01.7
    CA-02.1
    CA-02.2
    CA-02.3
    CA-02.4
    CA-02.5
    CA-02.6
    CA-02.7
    CA-02.8
    CA-02.9
    CA-02.10
    CA-02.11
    CA-03
    CA-03
    CA-03
    CA-03
    CA-03


    I need to continue this auto-fill in sequential order for hundreds of CA-##s, please help.


    Thanks!
  • To post as a guest, your comment is unpublished.
    autumn dell · 1 years ago
    I have a series of data and I want to assign every data which repeat more than 6 times in a row with the value zero. How can I do it? plz, help me out?
  • To post as a guest, your comment is unpublished.
    tejenndra · 2 years ago
    i have this data in sheet1, i work in this sheet on daily basis.

    after that i make New Sheet on State Wise Name Like DL, UK, JK, MH etc.
    is there any formula who automatic record State entry in State sheet, Like All DL related entry automatic record in DL Sheet.
    ID I2 I3 I4 STATE
    101 a j 99 DL
    102 b k 55 UK
    103 c l 44 JK
    104 d m 22 MH
    105 e n 33 DL
    106 f o 77 WB
    107 g p 25 DL
    • To post as a guest, your comment is unpublished.
      skyyang · 2 years ago
      Hello, tejenndra,
      As your problem, may be the Kutools for Excel's Split Data feature can help you. With the Split Data utility , you can quickly split the data from one sheet to others based on column or row.

      Take your data for example, after applying the Split Data feature, you will get the following result:

      Please let me know if this can help you! Thank you!
  • To post as a guest, your comment is unpublished.
    Brandon · 2 years ago
    I have a column with the same #s listed, but when the formula reaches a duplicate number, it gives an #N/A.


    --Order-- --Serial--
    --1132595277-- --1--
    --1132595201-- --2--
    --1132595277-- --#N/A--
    • To post as a guest, your comment is unpublished.
      skyyang · 2 years ago
      Hi, Brandon,
      I have tested your example in my workbook, but the formulas work well, can you attach your file or try the formulas again?
      Thanks! (a)
  • To post as a guest, your comment is unpublished.
    BUNLEE CHAN · 2 years ago
    in case there are 2 values, i have apply with below formula, but assign unique is going to be error for duplicate value1 & value2, could you pls help advise how to deal with this?

    =IF(COUNTIFS($A$2:A7,A7,$B$2:B7,B7)=1,MAX($C$1:C6)+1,VLOOKUP(A7&B7,$A$1:C7,2,0))

    Ex:

    Value1 Value 2 Assign unique
    AA 11 1
    BB 22 2
    AA 11 #N/A
    • To post as a guest, your comment is unpublished.
      skyyang · 2 years ago
      Hello,

      If you have multiple columns need to use, first, you can combine the columns into a new helper column by using this formula:=A2&" "&B2,and then apply above
      formula based on the helper column. you will get the result as you need.


      Here is an image example, hope it can help you, thank you!