Complex look up formula needed

clau818

New Member
Joined
Oct 31, 2016
Messages
32
Hi all,

I have a sheet where the header row are Ground Shipping Locations and the numbers beneath it are the first 3 numbers of zip codes that pertain to that ground shipping location.

I need a formula that will return the Ground Shipping location upon entering the zipcode. The issue I am having is that the ground shipping locations appear multiple times in different columns. See an example below. Please HELP! and thanks in advance! The formula I put together which is not working is =INDEX(Sheet2!A1:DX78,1,SMALL(IF(Sheet2!A1:DX78=I3,COLUMN(Sheet2!A1:DX1),99*99),1)) where 'sheet 2' is where the data below is located and cell I3 is where I am entering the zipcode on a separate sheet.

The top row is the header row with the ground shipping locations. The numbers underneath are the zip codes associated with that ground shipping locations.

Ground002045045002003002003004003004003002
004006009010014015017043045046050052
005007009011014016018044045047051053
012019048
013020049
021
022
023
024
025
026
027
028
029
030
031
032
033
034
035
036
037
038
039
040
041
042

<colgroup><col width="64" span="13" style="width:48pt"> </colgroup><tbody>
</tbody>
 
If you go to cell formatting and switch from a number format to Text, that does not change the data from a number to Text.
With your data being digits only, Excel should give a Green corner warning that the data is a number stored as text or preceded by a single quote.
When entering the lookup value, it too must be entered as text, which I prefer to force by typing the preceding single quote.
Alternatively you could force the lookup value to be TEXT(H1,"000")

You should still be able to use all numeric data formatted as "000".
(I do not like using numbers for none mathematical values like zip codes, but that is a personal preference.)
 
Upvote 0

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
This should do the trick as well. Since it's an array formula, remember to close it with Ctrl + Shift + Enter.

=INDEX(B1:M1,1,SUM(IF(Q5=B2:M27,COLUMN(B2:M27),0))-COLUMN(B1)+1)
 
Upvote 0
Thank you all so much! It finally worked!

The problem was that all my zip codes that started with 0's were appearing with the green flag and all the zip codes starting with 1-9 were not. I didn't realize this until SpillerBD told me about the formula to convert numbers to text, which I was unaware of. Even if I highlight the whole sheet and converting it all to text using the formatting function, this was not resulting in the zip codes 1-9 appearing with the green fla. After using the formula =Text(H1,"000") and copying paste special values the results over my original data, they appeared with the green flags. I tried all of your formulas now and they all worked! So i decided to go with the simplest one which was SpillerBD's simple Lookup formula.

Again thank you all! You're all excel geniuses and I strive to some day be as proficient in excel as you guys!
 
Upvote 0

Forum statistics

Threads
1,216,124
Messages
6,128,990
Members
449,480
Latest member
yesitisasport

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top