Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
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 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Code help, delete rows based on column criteria | Excel Discussion (Misc queries) | |||
Why doesn't the code create a column stacked chart? | Charts and Charting in Excel | |||
CREATE NEW WORKBOOK AND SHEETS BASED ON COLUMN DATA | Excel Worksheet Functions | |||
How to create a form to insert a hyerlink.VBA code to create a for | Excel Discussion (Misc queries) | |||
how to create a chart based on the content of a column | Excel Discussion (Misc queries) |