+ Reply to Thread
Results 1 to 7 of 7

Can I search for a number in a range?

  1. #1
    Registered User
    Join Date
    12-23-2005
    Location
    Berkshire UK
    MS-Off Ver
    2010
    Posts
    22

    Red face Can I search for a number in a range?

    I have a spreadsheet with cells containing the age of a person. What I want to do is specify which age range that person falls into.

    For example:

    Bill Smith 34 I would like a formula that says he is between 30 - 39.
    Jane Doe 22 I would like a formula that says she is between 20 - 29

    I don't want to have to do a separate formula for each of the 300+ entries.

    I have a separate table with the age ranges in and have tried to work it out with VLOOKUP and nested IF but I cant seem to get it to work!

    Help would be very appreciated.

    Thanks

  2. #2
    Forum Expert
    Join Date
    09-01-2012
    Location
    Norway
    MS-Off Ver
    Office 365
    Posts
    2,883

    Re: Can I search for a number in a range?

    If you post a workbook with some sample data it will be much easier to help you.
    <----- If you were helped by my posts you can say "Thank you" by clicking the star symbol down to the left

    If the problem is solved, finish of the thread by clicking SOLVED under Thread Tools
    I don't wish to leave you with no answer, yet I sometimes miss posts. If you feel I forgot you, remind me with a PM or just bump the thread.

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

    Re: Can I search for a number in a range?

    Try this...

    Data Range
    A
    B
    C
    D
    E
    1
    ------
    ------
    ------
    ------
    ------
    2
    56
    50 - 59
    0
    0 - 9
    3
    10
    10 - 19
    4
    20
    20 - 29
    5
    30
    30 - 39
    6
    40
    40 - 49
    7
    50
    50 - 59
    8
    60
    60 - 69
    9
    70
    70 - 79
    10
    80
    80 - 89
    11
    90
    90 - 99
    12
    100
    100 - 109


    This formula entered in B2:

    =LOOKUP(A2,D2:E12)
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  4. #4
    Registered User
    Join Date
    12-23-2005
    Location
    Berkshire UK
    MS-Off Ver
    2010
    Posts
    22

    Re: Can I search for a number in a range?

    ID Age Age range
    1 30 Its this one I need
    2 26
    3 24
    4 27
    5 25
    6 32
    7 50
    8 38
    9 41
    10 20
    11 49
    12 19
    13 45
    14 28
    15 22
    16 24
    17 48
    18 19
    19 29
    20 19

  5. #5
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: Can I search for a number in a range?

    You could try something like this... =LOOKUP(A2,{0,21,31,41,51,61,71,81,91},{"0-20","21-30","31-40","41-50","51-60","61-70","71-80","81-90","90+"})
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,937

    Re: Can I search for a number in a range?

    If you have your data in B1 try below formula in C1 and copy towards down
    =IFERROR(LOOKUP(B1,{1,10,20,30,40,50,60,70,80,90,100},{"0-9","10-19","20-29","30-39","40-49","50-59","60-69","70-79","80-89","90-99","100 & above"}),"")
    Please Login or Register  to view this content.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  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: Can I search for a number in a range?

    Like this...

    Data Range
    A
    B
    C
    D
    E
    F
    1
    ID
    Age
    Age Range
    Age
    Range
    2
    1
    30
    30 - 39
    0
    0 - 9
    3
    2
    26
    20 - 29
    10
    10 - 19
    4
    3
    24
    20 - 29
    20
    20 - 29
    5
    4
    27
    20 - 29
    30
    30 - 39
    6
    5
    25
    20 - 29
    40
    40 - 49
    7
    6
    32
    30 - 39
    50
    50 - 59
    8
    7
    50
    50 - 59
    60
    60 - 69
    9
    8
    38
    30 - 39
    70
    70 - 79
    10
    9
    41
    40 - 49
    80
    80 - 89
    11
    10
    20
    20 - 29
    90
    90 - 99
    12
    11
    49
    40 - 49
    100
    100 - 109
    13
    12
    19
    10 - 19
    14
    13
    45
    40 - 49
    15
    14
    28
    20 - 29
    16
    15
    22
    20 - 29
    17
    16
    24
    20 - 29
    18
    17
    48
    40 - 49
    19
    18
    19
    10 - 19
    20
    19
    29
    20 - 29
    21
    20
    19
    10 - 19
    22
    ------
    ------
    ------
    ------
    ------
    ------


    This formula entered in C2 and copied down:

    =LOOKUP(B2,E$2:F$12)

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. How do I search a number range?
    By techs in forum Excel General
    Replies: 5
    Last Post: 02-27-2015, 09:17 AM
  2. Replies: 5
    Last Post: 12-21-2013, 03:03 PM
  3. search for a number in a range
    By arnab0711 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-17-2012, 06:17 AM
  4. Search for Range not single number
    By jonn in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-16-2007, 09:45 AM
  5. Search for Range not single number
    By jonn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 04-12-2007, 08:28 AM
  6. [SOLVED] How to use an index number in a search range
    By Nick Krill in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2006, 02:20 PM
  7. How do I create a function to search a range for a number and...
    By NECCExcel in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 11-18-2005, 05:20 PM

Tags for this Thread

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