Reputation: 16782
The outcome I am trying to achieve is illustrated in the image below. Here is how I have set it up right now.
=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
Upvotes: 0
Views: 31
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