OwenNeedsVBAHelp
New Member
- Joined
- Aug 22, 2023
- Messages
- 6
- Office Version
- 365
- Platform
- Windows
Hi,
Thanks in advance for your time.
Im trying to match zipcodes in one column with zipcodes in another column in an array, to then return an associated value in another column in the array. I managed to make it work using vlookup with approximate values, but would prefer to use identical values so I'd like to understand what went wrong.
The zip codes are all identical in format - I used two different methods for this and both worked to produce identical formats, but exact match with vlookup and index(match) still didn't work. First I used =clean(text(zipcode, "00000") on both columns, and formatted both as the special zipcode format. I then tried =trim(zipcode) on both columns. For both methods I made sure to eliminate trailing spaces so each column has identical zip codes, in the same format, with exactly 5 characters. Neither solution worked for the identical match.
The Vlookup function I used was:
=vlookup(zipcode, $g$2:$n$100, 8, FALSE).
Where column G has zipcodes and column N has the desired return value.
The zipcode lookup value corresponds to an identical value in g2:g100, but the formula still returns NA instead of the corresponding value in column N.
The Index(match) I used was:
=index($n$2:$n$100, match(zipcode, $g$2:$g$100, 0), 1)
Where column G has zipcodes and column N has the desired return value.
This also returned NA instead of the corresponding value in column N.
I'm not sure what could be going wrong here, am I missing something? Is there another common vlookup/index(match) error that produces N/A results? Does anyone know a formula to consistently make sure zip codes in two columns exactly match each other?
Thanks again for taking the time to read.
Thanks in advance for your time.
Im trying to match zipcodes in one column with zipcodes in another column in an array, to then return an associated value in another column in the array. I managed to make it work using vlookup with approximate values, but would prefer to use identical values so I'd like to understand what went wrong.
The zip codes are all identical in format - I used two different methods for this and both worked to produce identical formats, but exact match with vlookup and index(match) still didn't work. First I used =clean(text(zipcode, "00000") on both columns, and formatted both as the special zipcode format. I then tried =trim(zipcode) on both columns. For both methods I made sure to eliminate trailing spaces so each column has identical zip codes, in the same format, with exactly 5 characters. Neither solution worked for the identical match.
The Vlookup function I used was:
=vlookup(zipcode, $g$2:$n$100, 8, FALSE).
Where column G has zipcodes and column N has the desired return value.
The zipcode lookup value corresponds to an identical value in g2:g100, but the formula still returns NA instead of the corresponding value in column N.
The Index(match) I used was:
=index($n$2:$n$100, match(zipcode, $g$2:$g$100, 0), 1)
Where column G has zipcodes and column N has the desired return value.
This also returned NA instead of the corresponding value in column N.
I'm not sure what could be going wrong here, am I missing something? Is there another common vlookup/index(match) error that produces N/A results? Does anyone know a formula to consistently make sure zip codes in two columns exactly match each other?
Thanks again for taking the time to read.