+ Reply to Thread
Results 1 to 9 of 9

Lookup help - can lookup address values that fall within a range?

  1. #1
    Registered User
    Join Date
    05-16-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    8

    Lookup help - can lookup address values that fall within a range?

    Dear all,

    I am trying to use LOOKUP to address values that fall within a range e.g. LOOKUP(F2,{"1000<F2<2000","2000<F2<3000","3000<F2<4000","4000<F2<5000","5000<F2<6000","6000<F2<7000"}, {1,2,3,4,5,6}). However, this formula doesn't work.

    The F column contains module codes e.g. 1103, 4105, 6107, etc. If the module code starts with 1, it is a Year 1 module, if it starts with 2 it is a Year 2 module and so on an so forth. I would like the Year to be reflected in another column using LOOKUP.

    Thanks for offering your suggestions

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Lookup help - can lookup address values that fall within a range?

    If you have a number like:

    F2: 1103

    And you just want to extract the 1st digit, try this:

    =--LEFT(F2)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    05-16-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Lookup help - can lookup address values that fall within a range?

    Whoops, I did a little more experimenting and realised I could use LEFT fx!

  4. #4
    Registered User
    Join Date
    05-16-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Lookup help - can lookup address values that fall within a range?

    Thank you so much Tony.

  5. #5
    Registered User
    Join Date
    05-16-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Lookup help - can lookup address values that fall within a range?

    Just another quick question - If the module code were displayed as AR1301, could I use something like MID fx to copy the first"1" into another column?

    Thanks v much for your help.

  6. #6
    Valued Forum Contributor Lemice's Avatar
    Join Date
    04-13-2013
    Location
    Somewhere.
    MS-Off Ver
    Excel 2016
    Posts
    696

    Re: Lookup help - can lookup address values that fall within a range?

    Hello,

    Your formula is supposed to be like this
    =LOOKUP(F2,{1000,2000,3000,4000,5000,6000,7000}, {1,2,3,4,5,6})

    Just out of curiosity, if you want the first digit, the thousands, why don't you use
    =INT(F2/1000)
    (copy pasta from Ford)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools

    Regards,
    Lem

  7. #7
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Lookup help - can lookup address values that fall within a range?

    If the 1st digit is always the 3rd character you could use this:

    =--MID(F2,3,1)

  8. #8
    Registered User
    Join Date
    05-16-2013
    Location
    Singapore
    MS-Off Ver
    Excel 2010
    Posts
    8

    Re: Lookup help - can lookup address values that fall within a range?

    Thanks Tony. Lem, both your suggestions work too. Thanks v much, lots for me to learn.

  9. #9
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Lookup help - can lookup address values that fall within a range?

    You're welcome. Thanks for the feedback!

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1