 • 441K Members
• 5,257 Online
• 529K Conversations

# How to make an Array formula with multiple nested if statements ? is there a better way?

Hello,

I am trying to create an IF formula that automates whether a destination is domestic or international. The destination will be entered by its airport code (BGI,LAS,) and a separate cell will determin if it is International or not.  I need this formula to be used in over 3k cells in the same row how would I array the formula to make it cleaner instead of coping and pasting 3k formulas.

Example:

If one of the below locations are entered in lets say cell i1 then Cell J1 I want it to show International or domestic

I1=BGI Then Cell J1 with the formula automates if it is international or domestic. In this case its International.

 Domestic International ABQ AUA ACK BDA ANU BGI ATL CTG

=IF(I4="BDA","International",IF(I4="BGI","International",IF(I4="AUA","International",IF(I4="CTG","International",IF(I4="ABQ","Domestic",IF(I4="ACK","Domestic",IF(I4="ANU","Domestic",IF(I4="ATL","Domestic"))))))))

6 Replies

# Re: How to make an Array formula with multiple nested if statements ? is there a better way?

@John Sokolowski If you reformat your table so it has airport code in column A and DOmestic or International in column B you can use VLOOKUP to get the information you need.

# Re: How to make an Array formula with multiple nested if statements ? is there a better way?

Thank you , So I did do that but one of the vlookups keeps returning the wrong value and I don't know why.

# Re: How to make an Array formula with multiple nested if statements ? is there a better way?

@John Sokolowski , if your airports are in columns A and B starting from first row where are column names, when it could be

`=IF(ISNUMBER(MATCH(I1,\$A:\$A,0)),\$A\$1,IF(ISNUMBER(MATCH(I1,\$B:\$B,0)),\$B\$1,"no such"))`

# Re: How to make an Array formula with multiple nested if statements ? is there a better way?

This is my code

I have a table on the master sheet with 2 columns.

When I run the below formula for "PSE" which is supposed to = DOM it returns "INTL". the formula is taking the information from the cell above PSE on the master list and returning that value instead of the value for PSE it is giving me the value for POS .

the table is sorted in alphabetical order

=VLOOKUP(C2825,'Master Sheet'!\$A\$2:\$C\$75,2,TRUE)

# Re: How to make an Array formula with multiple nested if statements ? is there a better way?

this is what I am getting  I put the code in one of the cells. I used Hlookup to see if it comes out differently but it doesn't .

 Org Region SEA DOM STI INTL SDQ INTL KIN INTL BTV DOM LAS DOM PSE #N/A(=HLOOKUP(C2827,Sheet3!\$A\$2:\$BV\$3,2,FALSE) SFO DOM BUR #N/A STI INTL SDQ INTL FLL DOM BQN DOM ONT DOM

# Re: How to make an Array formula with multiple nested if statements ? is there a better way?

@John Sokolowski , if VLOOKUP returns the value above it means it didn't find PSE. Check manually if the match like

`=C2825='Master Sheet'!\$A\$66`

(or where is that value in master sheet) if it returns TRUE or FALSE. That could be extra space like "PSE ", or non-printable character, or like.

Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
35 Replies
Extentions Synchronization
Deleted in Discussions on
3 Replies
flashing a white screen while open new tab
Deleted in Discussions on
14 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies