Categorise based on combination in a comma separated string

Balajibenz

Board Regular
Joined
Nov 18, 2020
Messages
80
Office Version
  1. 2013
Platform
  1. Windows
Can you people help me with below query using a VBA code or excel formula (if it is feasible and doestn't take time).

I have data in sheet1 where there is ID in column "A" and category in Column "B". category will have multiple text separated by commas. Possible categories are - Production, Development, Staging, Test, Training, UserAcceptanceTest, DisasterRecovery. what i am looking for is to have below result in column "C" for the below mentioned scenarios.

If Category column is as below then Column "C" values should be the one after "-" as below

1. empty - No
2. Development - Dev
3. Production - Prod
4. Test - Test
5. Staging - Staging
6. Training - Training
7. UserAcceptanceTest - UAT
8. Development AND Test AND Production OR any other category - All
9. Development AND Test OR any other category (Except Production) - Dev/Test
10. Test AND Production OR any other category (Except Development) - Dev/Test
11. Development AND any other category (Except Production and Test ) - Dev
12. Production AND any other category (Except Development and Test ) - Prod
13. Test AND any other category (Except Development and Production) - Test
14. any other scenarion - Not Defined


Below is the sample data for the reference. original data has 1k lines and I couldn't share it due to access issues.

IDCategory
121Production
135Production, Development, Staging, Test, Training, UserAcceptanceTest
283Development, Test
1058Production, Test
148UserAcceptanceTest, Development
1125Production, UserAcceptanceTest
1138
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
Can you people help me with below query using a VBA code or excel formula (if it is feasible and doestn't take time).

I have data in sheet1 where there is ID in column "A" and category in Column "B". category will have multiple text separated by commas. Possible categories are - Production, Development, Staging, Test, Training, UserAcceptanceTest, DisasterRecovery. what i am looking for is to have below result in column "C" for the below mentioned scenarios.

If Category column is as below then Column "C" values should be the one after "-" as below

1. empty - No
2. Development - Dev
3. Production - Prod
4. Test - Test
5. Staging - Staging
6. Training - Training
7. UserAcceptanceTest - UAT
8. Development AND Test AND Production OR any other category - All
9. Development AND Test OR any other category (Except Production) - Dev/Test
10. Test AND Production OR any other category (Except Development) - Dev/Test
11. Development AND any other category (Except Production and Test ) - Dev
12. Production AND any other category (Except Development and Test ) - Prod
13. Test AND any other category (Except Development and Production) - Test
14. any other scenarion - Not Defined


Below is the sample data for the reference. original data has 1k lines and I couldn't share it due to access issues.

IDCategory
121Production
135Production, Development, Staging, Test, Training, UserAcceptanceTest
283Development, Test
1058Production, Test
148UserAcceptanceTest, Development
1125Production, UserAcceptanceTest
1138
Can someone please help me with this as I am running out of time. Just in case if want to know the background please have a look at below link.

 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,154
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top