I have a table that looks like the one below.
Table I have
I want an output classifying the PART as either CLASS A or B. CLASS A and CLASS B should be created as two additional columns.
The conditions for classifications are:
-> IF Arrangement, Prefix and Range are the same, it will be classified as CLASS A and CLASS B, and the PART should be in both columns.
-> If the above condition is false, it will check the value in the TYPE column. If the type column contains CLASS A, then the respective PART should be in the CLASS A column. If the type column contains CLASS B, then the separate PART should be in the CLASS B column.
Here is the sample of the output I would need.
Table I want
So far, I have managed to get the below output but have not been able to merge the results into one row when the three columns are the same.
Results I got till now
Sample Data
Arrangements PREFIX RANGE PART TYPE
ARR1 1XJ 1-100 191123 TRANSMISSION CLASS A
ARR1 1XJ 1-100 299123 TRANSMISSION CLASS B
ARR1 9TC 1-100 191123 TRANSMISSION CLASS A
ARR2 5TJ 101-120 288123 TRANSMISSION CLASS B




