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>
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Try something like this. Everything (except H2) is formatted as Text to keep the leading 0's.


Excel 2010
ABCDEFGH
1Ground002045045002Zip Code007
2004006009010Ground045
3005007009011
4012
5013
Sheet2
Cell Formulas
RangeFormula
H2=INDEX(B1:E1,SUMPRODUCT(COLUMN(B2:E5)*(B2:E5=H1)))
 
Upvote 0
Try this:
Code:
=SUMPRODUCT(--(B2:M25=$O$1)*(B1:M1))/COUNTIF($B$2:$M$25,O1)

Where B2:M25 is where the data is located not including the Ground Shipping Location. O1 is where you enter your zip code and B1:M1 is the Ground Shipping Location.
 
Upvote 0
Try this:
Code:
=SUMPRODUCT(--(B2:M25=$O$1)*(B1:M1))/COUNTIF($B$2:$M$25,O1)

Where B2:M25 is where the data is located not including the Ground Shipping Location. O1 is where you enter your zip code and B1:M1 is the Ground Shipping Location.

Thanks for this! So it seems like this formula works for any zipcode that begins with a 0 but for the ones that begin with 1-9, it is not returning the correct value. Any idea why this could be?

Thanks again!
 
Upvote 0
Thanks for this! So it seems like this formula works for any zipcode that begins with a 0 but for the ones that begin with 1-9, it is not returning the correct value. Any idea why this could be?

Thanks again!

Sorry about that! I mean to send this to 63falcondude!
 
Upvote 0
Try something like this. Everything (except H2) is formatted as Text to keep the leading 0's.

Excel 2010
ABCDEFGH
1Ground002045045002Zip Code007
2004006009010Ground045
3005007009011
4012
5013

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet2

Worksheet Formulas
CellFormula
H2=INDEX(B1:E1,SUMPRODUCT(COLUMN(B2:E5)*(B2:E5=H1)))

<thead>
</thead><tbody>
</tbody>

<tbody>
</tbody>

Thanks for this! So it seems like this formula works for any zipcode that begins with a 0 but for the ones that begin with 1-9, it is not returning the correct value. Any idea why this could be?

Thanks again!
 
Upvote 0
Try this:
Code:
=SUMPRODUCT(--(B2:M25=$O$1)*(B1:M1))/COUNTIF($B$2:$M$25,O1)

Where B2:M25 is where the data is located not including the Ground Shipping Location. O1 is where you enter your zip code and B1:M1 is the Ground Shipping Location.
Actually i'm having the same problem with your formula. It returns the right value for any zip code starting with 0's but when I try a zipcode starting with 1, it returns a 0. Also the value being returned is showing up as 2 or 3 or 4 rather than 002 or 003 or 004.

Again, thanks for your help!
 
Upvote 0
Just use LOOKUP.
(again make sure values are the same type, ie Text or numeric)
Code:
=LOOOKUP(H1,$B$2:$E$5,$B$1:$E$1)
 
Upvote 0
Just use LOOKUP.
(again make sure values are the same type, ie Text or numeric)
Code:
=LOOOKUP(H1,$B$2:$E$5,$B$1:$E$1)

Oh, and do not have blank cells. populate the blank cells with "000"
 
Upvote 0

Forum statistics

Threads
1,215,066
Messages
6,122,948
Members
449,095
Latest member
nmaske

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