简体   繁体   中英

Search ZIP code range and pull corresponding Zone

I have a workbook that has the first three digits of a ZIP code in both columns A and B. A is the lower bound of the range and B is the upper bound. I then have the corresponding zone for that ZIP code range in column C. I tried the following formula with no luck.

=LOOKUP(2,1/((I11>=A10:A101)*(I11<=B10:B101)),D10:D101)

What I am trying to accomplish is to use this formula to grab the appropriate zone for any ZIP code entered, to streamline the process of doing a cost analysis for a potential customer. If it is easier to achieve this using a VBA script I am open to that as well.

Here is an example of the first three rows of data from my workbook:

Lower Bounds | Upper Bounds | Zone
004          | 005          | 008
006          | 007          | 045
009          |              | 045

If Lower Bounds is in A1 and what you are looking up in E2, please try:

=INDEX(C:C,MATCH(E2,A:A))  

Make sure ColumnA is sorted ascending.

Is removing the upper bounds and creating a two column list out of the question? If not then you can use =LOOKUP(2,A10:A101,C10:D101)

Zip  Zone
004  008
005  008
006  045
007  045
009  045

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM