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,
W.E.BAsked:
Who is Participating?
 
Saqib Husain, SyedEngineerCommented:
.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)), IFERROR(INDEX({"""",""London"",""Burlington"",""Oakville""},,MATCH(LEFT((Y2),2), {"""",""LL"",""LB"",""LO""}, 0)), ""Montreal""))"
0
 
Saqib Husain, SyedEngineerCommented:
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)))"
0
 
W.E.BAuthor Commented:
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
0
 
W.E.BAuthor Commented:
Thank you
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.