puk
puk

Reputation: 16782

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
  2. Column B is a list of project names. Data validation restricts its inputs to columns E3:E6. This is user selected
  3. Column C is unique and must not have any duplicates. This is achieved by setting data validation to the following equation =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. It is, however, user entered at the moment.

How can I make it so the user does not have to enter the task ID. Instead, I want it to be automatically generated when the user selects the Project in column 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

enter image description here

Upvotes: 0

Views: 31

Answers (1)

user4039065
user4039065

Reputation:

In B2 use,

=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,

=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,

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

Upvotes: 1

Related Questions