Create Code Based on Column

  • Thread starter Thread starter Brainfire
  • Start date Start date
B

Brainfire

Hi....

I've got a spreadsheet with 37,000 rows - one of the columns in this
is an activity description, and many of these descriptions are
repeated multiple
times in the column. What I need to do, either with a formula or VBA,
is to assign each activity description a code in the next column in
the format T0001, T0002, etc. So, 'Job 1 = T0001, 'Job 2 = T0002,
etc.


Can anyone help?


TIA
 
hi
formula....
=if(D2="job 1", "T0001",if(D2="job1,job2","T0002,T0002",""))
you can stack 7 ifs this way for 7 different combinations. if you have more
than 7 jobs or if the jobs are "jumbled up", you have a problem.

A macro could offer more ifs but if jumbled up ie job2, job1 instead of
job1, job2, you have a serious problem.

Regards
FSt1
 
Another option....

Use data|filter|advanced filter to get a list of unique descriptions into
another sheet.

Debra Dalgleish shows how:
http://www.contextures.com/xladvfilter01.html#FilterUR

Delete the headers in row 1
and sort the list if you want.

then in B1, put this formula:
="T"&text(row(),"0000")
and drag down.

Then convert these to values (edit|copy, edit|paste special|values)

Then back to the original sheet
insert a new column that's adjacent to the descriptions
and use something like:
=vlookup(a2,sheet2!a:b,2,false)
to return the code.

Debra Dalgleish has lots of notes on =vlookup():
http://www.contextures.com/xlFunctions02.html
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top