Link to home
Start Free TrialLog in
Avatar of W.E.B
W.E.B

asked on

Excel Formula

Hello,
Can you please help,
I need to combine below 2 formulas. (part of Macro code)

        .Formula = "=IFERROR(INDEX({"""",""Halifax"",""Toronto"",""Toronto"",""Ottawa"",""Ottawa"",""Waterloo"",""Vancouver"",""Montreal"",""Montreal""},,MATCH(LEFT(Y2), {"""",""H"",""T"",""N"",""O"",""B"",""K"",""V"",""M"",""G""}, 0)), ""Montreal"")"
     
   .Formula = "=(INDEX({"""",""London"",""Burlington"",""Oakville""},,MATCH(LEFT((Y2),2), {"""",""LL"",""LB"",""LO""}, 0)))"

Any help is appreciated,
Thank you,
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Try
 .Formula = "=IFERROR(INDEX({"""",""Halifax"",""Toronto"",""Toronto"",""Ottawa"",""Ottawa"",""Waterloo"",""Vancouver"",""Montreal"",""Montreal""},,MATCH(LEFT(Y2), {"""",""H"",""T"",""N"",""O"",""B"",""K"",""V"",""M"",""G""}, 0)), INDEX({"""",""London"",""Burlington"",""Oakville""},,MATCH(LEFT((Y2),2), {"""",""LL"",""LB"",""LO""}, 0)))"
Avatar of W.E.B
W.E.B

ASKER

Hello,
I tried this already,
the problem with it is,
If the City Code is not found, it has to say Montreal,
With this formula, it says #N/A

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Saqib Husain
Saqib Husain
Flag of Pakistan image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of W.E.B

ASKER

Thank you