ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Create Code Based on Column (https://www.excelbanter.com/excel-discussion-misc-queries/145743-create-code-based-column.html)

Brainfire

Create Code Based on Column
 
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


FSt1

Create Code Based on Column
 
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

"Brainfire" wrote:

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



Dave Peterson

Create Code Based on Column
 
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

Brainfire wrote:

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


--

Dave Peterson


All times are GMT +1. The time now is 05:17 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com