Forum Discussion
If statements with multiple conditions
- Jan 30, 2021
If you have the flexibility to name cities with the same abbreviation that is in your header, then it's a fairly simple formula: =IFERROR(IF(FIND(G$2,$F3)>0,"X"),"")
That formula can be copied to every cell in that table and work. But it works when the values in the cell in column F look like this, not when you have the abbreviation in the heading (BOS) but the full name spelled out ("Boston") in the cell being evaluated.
OR you could spell the name out fully in each case and that too would work. What you need is consistency.
You and I with our more flexible brains are able to know DFW means Dallas/Fort Worth, and a formula could be written to let Excel recognize it as well, or perhaps a table created to for the formula to refer to.
I guess the question to you is how super sophisticated (i.e., flexible) you want the solution to be.
GlynWilliams See attached. Note that you need to use the same abbreviations in F as the ones you have in row 2.
- GlynWilliamsJan 30, 2021Copper Contributor
Riny_van_Eekelen This is great thank you so much! This saves my overworked staff member a lot of time!
- mathetesJan 30, 2021Silver Contributor
I think that the answer you got from @Riny_van_Eekelen is a bit more elegant than mine; one of the delightful aspects of Excel is that there are almost always multiple ways to get to a given solution for any given problem. In this case, as Sergei and I both suggested, you could also have an elaborate table that connected the airport codes (or other abbreviations) with spelled out names. The potential problem with that is that spelling still matters, and humans are not always reliable in their speling.
- PeterBartholomew1Jan 30, 2021Silver Contributor
Same solution with dynamic arrays.
The next step was to apply the number format X;;;
humans are not always reliable in their speling.
LOL