I am trying to split the array in column B which is separated by commas and then look for each item and if the condition is satisfied then publish something in column C.
I have lot of scenarios with combination of both AND/OR conditions.
At the end if none of scenarios is satisfied then in column "C" it should be "not defined".
Dim Cl As Range
Dim Dic As Object
Dim Sp As Variant
Dim i As Long
Set Dic = CreateObject("Scripting.dictionary")
With Sheets("Analysis")
For Each Cl In .Range("A2", .Range("A" & Rows.Count).End(xlUp))
Sp = Split(Cl.Offset(, 1).Value, ",")
Select Case Cl.Offset(, 1).Value
Case Is = " "
C1.Offset(, 2).Value = " "
Case Is = "Production"
C1.Offset(, 2).Value = "Prod"
Case Is = "Production" And "Development" Or "Training"
C1.Offset(, 2).Value = "Dev/Prod"
End Select
Next Cl
End With
End Sub
Sample data where column A has Id and column B has category.
ID | CATEGORY |
---|---|
131 | Production |
124 | Production, Development, Staging, Test, Training, UserAcceptanceTest |
283 | Development, Test |
1138 | empty. |
I am looking for 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 "-".
- empty - No
- Development - Dev
- Production - Prod
- Test - Test
- Staging - Staging
- Training - Training
- UserAcceptanceTest - UAT
- Development AND Test AND Production OR any other category - All
- Development AND Test OR any other category (Except Production) - Dev/Test
- Test AND Production OR any other category (Except Development) - Dev/Test
- Development AND any other category (Except Production and Test ) - Dev
- Production AND any other category (Except Development and Test ) - Prod
- Test AND any other category (Except Development and Production) - Test
- any other scenario - Not Defined