So I've run into a problem that I believe there is a solution for, however, I am not keen on how to implement the function.
In the chart below you'll notice that all of the FALSE returns highlighted are actually TRUE.
The code is as follows:
Range("AC2").Formula = "=IF(LEFT(K2,4)=LEFT(AB2,4),True,False)"
I'm pretty much just seeing if the first 4 letters of the USER DEFINED destination match the first 4 of the actual destination. What I need to be testing is: is "AA" contained in "AB".
I was told that I can use INSTR to get accurate results, but after looking at some examples, I don't see how declaring the "position" in which to start looking for a specific string like "Detroit" is going to help me.
It can't be this complicated; has to be simpler such as: IF "AB" contains "AA" then TRUE, if not FALSE
[TABLE="width: 629"]
<tbody>[TR]
[TD]Customer ID (Z)[/TD]
[TD]User Defined Destination (AA)[/TD]
[TD]Airport Code Destination (AB)[/TD]
[TD]Dest. Match? (AC)[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]SLC[/TD]
[TD]SALT LAKE CITY[/TD]
[TD]Salt Lake City, UT[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]MSP[/TD]
[TD]SAINT PAUL[/TD]
[TD]Minneapolis - St. Paul Int'l[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]MSP[/TD]
[TD]MINNEAPOLIS[/TD]
[TD]Minneapolis - St. Paul Int'l[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]HNL[/TD]
[TD]HONOLULU[/TD]
[TD]Honolulu, HI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]SLC[/TD]
[TD]SALT LAKE CITY, UT[/TD]
[TD]Salt Lake City, UT[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]HNL[/TD]
[TD]HONOLULU[/TD]
[TD]Honolulu, HI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]LAS[/TD]
[TD]LAS VEGAS[/TD]
[TD]Las Vegas, NV[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]EWR[/TD]
[TD]NEWARK[/TD]
[TD]New York - Newark, NJ[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]PHX[/TD]
[TD]SKY HARBOR[/TD]
[TD]Phoenix, AZ - Sky Harbor[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]ATL[/TD]
[TD]ATLANTA[/TD]
[TD]Atlanta, Hartsfield Atlanta[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]ATL[/TD]
[TD]HARTFIELD[/TD]
[TD]Atlanta, Hartsfield Atlanta[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]ATL[/TD]
[TD]ATLANTA[/TD]
[TD]Atlanta, Hartsfield Atlanta[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]ATL[/TD]
[TD]ATLANTA[/TD]
[TD]Atlanta, Hartsfield Atlanta[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]CLT[/TD]
[TD]CHARLOTTE[/TD]
[TD]Charlotte, NC[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]EWR[/TD]
[TD]NEWARK[/TD]
[TD]New York - Newark, NJ[/TD]
[TD]FALSE[/TD]
[/TR]
</tbody>[/TABLE]
In the chart below you'll notice that all of the FALSE returns highlighted are actually TRUE.
The code is as follows:
Range("AC2").Formula = "=IF(LEFT(K2,4)=LEFT(AB2,4),True,False)"
I'm pretty much just seeing if the first 4 letters of the USER DEFINED destination match the first 4 of the actual destination. What I need to be testing is: is "AA" contained in "AB".
I was told that I can use INSTR to get accurate results, but after looking at some examples, I don't see how declaring the "position" in which to start looking for a specific string like "Detroit" is going to help me.
It can't be this complicated; has to be simpler such as: IF "AB" contains "AA" then TRUE, if not FALSE
[TABLE="width: 629"]
<tbody>[TR]
[TD]Customer ID (Z)[/TD]
[TD]User Defined Destination (AA)[/TD]
[TD]Airport Code Destination (AB)[/TD]
[TD]Dest. Match? (AC)[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]SLC[/TD]
[TD]SALT LAKE CITY[/TD]
[TD]Salt Lake City, UT[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]MSP[/TD]
[TD]SAINT PAUL[/TD]
[TD]Minneapolis - St. Paul Int'l[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]MSP[/TD]
[TD]MINNEAPOLIS[/TD]
[TD]Minneapolis - St. Paul Int'l[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]HNL[/TD]
[TD]HONOLULU[/TD]
[TD]Honolulu, HI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]SLC[/TD]
[TD]SALT LAKE CITY, UT[/TD]
[TD]Salt Lake City, UT[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]HNL[/TD]
[TD]HONOLULU[/TD]
[TD]Honolulu, HI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]LAS[/TD]
[TD]LAS VEGAS[/TD]
[TD]Las Vegas, NV[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]EWR[/TD]
[TD]NEWARK[/TD]
[TD]New York - Newark, NJ[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]PHX[/TD]
[TD]SKY HARBOR[/TD]
[TD]Phoenix, AZ - Sky Harbor[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]ATL[/TD]
[TD]ATLANTA[/TD]
[TD]Atlanta, Hartsfield Atlanta[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]ATL[/TD]
[TD]HARTFIELD[/TD]
[TD]Atlanta, Hartsfield Atlanta[/TD]
[TD]FALSE[/TD]
[/TR]
[TR]
[TD]ATL[/TD]
[TD]ATLANTA[/TD]
[TD]Atlanta, Hartsfield Atlanta[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]ATL[/TD]
[TD]ATLANTA[/TD]
[TD]Atlanta, Hartsfield Atlanta[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]DTW[/TD]
[TD]DETROIT[/TD]
[TD]Detroit, MI[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]CLT[/TD]
[TD]CHARLOTTE[/TD]
[TD]Charlotte, NC[/TD]
[TD]TRUE[/TD]
[/TR]
[TR]
[TD]EWR[/TD]
[TD]NEWARK[/TD]
[TD]New York - Newark, NJ[/TD]
[TD]FALSE[/TD]
[/TR]
</tbody>[/TABLE]