FrenchConnections
FrenchConnections

Reputation: 391

Formula or macro to group cells according to their values

I am on a spreadsheet that needs to retitle cells based on the cell value and the values of the cells below it. Basically I have the below column, which is filled by a formula that links to another spreadsheet.

Column A
EE
EE
SP
EE
CH
CH
EE
SP
CH
CH
EE

The above column should then look like:

Column A
EE Only
EE+SP
EE+SP
EE+CH
EE+CH
EE+CH
EE+FAM
EE+FAM
EE+FAM
EE+FAM
EE Only

It's a long table of values, and quite honestly I'm not even sure what the best way to go about this is.

Do I need to create a table of values to lookup against, or is there a macro that would be able to handle this?

Upvotes: 0

Views: 145

Answers (1)

pnuts
pnuts

Reputation: 59440

From your input example:

=IF(AND(A2<>"EE",B1="EE+FAM"),"EE+FAM",IF(AND(A2="EE",OR(A3="EE",A3="")),"EE Only",IF(OR(AND(A1="EE",A2="SP",A3="EE"),AND(A2="EE",A3="SP",A4="EE")),"EE+SP",IF(OR(A2="CH",A3="CH"),"EE+CH",IF(AND(A2="EE",A3<>"EE"),"EE+FAM","")))))  

should derive your output example.

Upvotes: 1

Related Questions