简体   繁体   English

计算Excel 2013中另一列中的重复项

[英]Counting Duplicates in another column in Excel 2013

The outcome I am trying to achieve is illustrated in the image below. 下图显示了我要实现的结果。 Here is how I have set it up right now. 这是我现在设置的方式。

  1. Column A is a list of unique numbers created by dragging down and filling series A列是通过向下拖动并填充序列创建的唯一编号的列表
  2. Column B is a list of project names. B列是项目名称的列表。 Data validation restricts its inputs to columns E3:E6. 数据验证将其输入限制为E3:E6列。 This is user selected 这是用户选择的
  3. Column C is unique and must not have any duplicates. C列是唯一的,并且不能重复。 This is achieved by setting data validation to the following equation =COUNTIF($C:$C,C2)=1 . 这可以通过将数据验证设置为以下公式=COUNTIF($C:$C,C2)=1 The Task ID should be the corresponding Project code (from cell F) of the Project Name of the cell on the same row, but in column B, then a hyphen, then the 3 digit incremented code. 任务ID应该是同一行中单元格“项目名称”的相应项目代码(来自单元格F),但在B列中,然后是一个连字符,然后是3位递增代码。 It is, however, user entered at the moment. 但是,此刻是用户输入的。

How can I make it so the user does not have to enter the task ID. 我如何做到这一点,以便用户不必输入任务ID。 Instead, I want it to be automatically generated when the user selects the Project in column B. 相反,我希望当用户在B列中选择“项目”时自动生成它。

NOTE this should not affect the outcome, however, in my case, the Project Names and Project Codes for data validation are on another sheet 注意这不会影响结果,但是,就我而言,用于数据验证的项目名称和项目代码在另一页上

在此处输入图片说明

In B2 use, 在B2使用中,

=index(e:e, match(left(c2, 2), f:f, 0))

If your project codes are not always 2 characters but are separated from the extraneous information by a hyphen use, 如果您的项目代码并非始终为2个字符,而是通过连字符将其与无关信息分开,

=index(e:e, match(left(c2, find("-", c2&"-")-1), f:f, 0))

It appears I interpreted the lookup backwards. 看来我向后解释了查找。 To lookup the Task ID prefix from the Project Codes and supply an increment suffix use the following in C2, 要从项目代码中查找任务ID前缀并提供增量后缀,请在C2中使用以下代码,

=INDEX(F:F,MATCH(B2,E:E,0))&TEXT(COUNTIF(B$2:B2, B2), "-000")

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM