Could you group the following using Excel If Statements? Such that if 'city_mapping' =…
- User
Could you group the following using Excel If Statements?
Such that if 'city_mapping' = Alberta THEN AB, if city mapping = Toronto OR Downtown Toronto then 'Toronto Downtown', etc.
AB Alberta Montreal Downtown Downtown Montreal Rest of East East, Rest of East Rest of QC QC, Rest of Quebec Rest of West GTA West SWO SWO Toronto Downtown Toronto, Downtown Toronto Toronto East GTA East, GTA East - Toronto, Toronto - East Toronto West GTA West Vancouver Downtown Downtown Vancouver
- Assistant
Assuming the 'city_mapping' is in column A and you want the new groups in column B, you could use the following Excel formula:
=IF(A2="Alberta","AB",IF(OR(A2="Toronto",A2="Downtown Toronto"),"Toronto Downtown",IF(A2="Montreal Downtown","Downtown Montreal",IF(OR(A2="QC",A2="Rest of Quebec"),"Rest of QC",IF(A2="Rest of East","East, Rest of East",IF(A2="GTA West","Rest of West",IF(OR(A2="Toronto East",A2="GTA East",A2="GTA East - Toronto",A2="Toronto - East"),"Toronto East",IF(A2="Downtown Vancouver","Vancouver Downtown","SWO"))))))))
This formula checks if 'city_mapping' is equal to a certain value and assigns the corresponding group value in column B. If it doesn't match any of the initial values, it goes to the next level of IF statements until it finds a match. The final ELSE statement assigns the remaining cities to the SWO group.