+ Reply to Thread
Results 1 to 12 of 12

Formula to search for a value in groups of cells and return the name of the smallest group

  1. #1
    Registered User
    Join Date
    11-26-2012
    Location
    Myrtleford, Australia
    MS-Off Ver
    Excel 2013
    Posts
    25

    Formula to search for a value in groups of cells and return the name of the smallest group

    Hi,

    I hoping to get help with a formula which will look for a value in a group of cells,
    If the value is found then the group name is returned.
    If the value is not found then the next group of cells is searched, and if found in that group then the name of that group is returned.
    If not found in that group then a third group is searched and so on.
    Please see the example spread sheet attached.

    Thank you.
    Attached Files Attached Files

  2. #2
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    N9:

    Please Login or Register  to view this content.
    This is an array formula, confirmed with Ctrl+Shift+Enter.

    Then copy downwards
    Last edited by daffodil11; 03-13-2014 at 06:10 PM.
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  3. #3
    Registered User
    Join Date
    11-26-2012
    Location
    Myrtleford, Australia
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    Hi daffodil11,
    thank you for your formula, it works perfectly. Really appreciate your help.

    I noticed the formula also works if I don't enter it as an array formula. Is it good practice to enter it as an array formula anyway?

    Best regards,
    Peter

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    Actually, it's totally way better to not do it as an array if you don't have it.

    Array formulas eat up valuable processor power, so when it can be avoided it's always best to do so.

  5. #5
    Registered User
    Join Date
    11-26-2012
    Location
    Myrtleford, Australia
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    Hi daffodil11,
    Thanks for taking the time to answer my question, so much to learn.
    really appreciate your help.
    Pete

  6. #6
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    No problem. Come back again!

  7. #7
    Registered User
    Join Date
    11-26-2012
    Location
    Myrtleford, Australia
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    Hi daffodil11,

    sorry to trouble you, when I try to use the formula in my bigger sheet I don't seem to be able to get it to work.
    I tried both the array and non array forms.
    Have attached another spread sheet.
    Regards,
    Pete
    Attached Files Attached Files

  8. #8
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    Let's approach this from a different angle:

    What is this? Does the data format matter? This puzzle would be considerably easier in another format.

  9. #9
    Registered User
    Join Date
    11-26-2012
    Location
    Myrtleford, Australia
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    do you mean the cell format? I don't think that will matter.
    If you mean the way the data is set out - I download the columns of data in that format. I can probably do something to change it before sorting.

  10. #10
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    Ok, Hulk Smash. I've been at work for over 12 hours so here's the ugly version because my brain is starting to shut down:

    Please Login or Register  to view this content.
    By definition, VLOOKUP won't function on noncontiguous ranges so instead we chain some together. If it doesn't find it, we check the next, then the next, and so on. You can even make all the ranges match if you wanted, such as ??9:??5000.
    Last edited by daffodil11; 03-13-2014 at 08:00 PM.

  11. #11
    Registered User
    Join Date
    11-26-2012
    Location
    Myrtleford, Australia
    MS-Off Ver
    Excel 2013
    Posts
    25

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    the ugly version looks as sweet as honey to me! works perfectly - thank so much.

  12. #12
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Formula to search for a value in groups of cells and return the name of the smallest g

    Good times, glad I could help.

+ 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. Search for groups of consecutively appearing cells.
    By jefflawrie in forum Excel General
    Replies: 3
    Last Post: 12-07-2012, 09:03 AM
  2. Search for groups of consecutively appearing cells.
    By jefflawrie in forum Excel General
    Replies: 2
    Last Post: 12-07-2012, 06:41 AM
  3. Replies: 6
    Last Post: 06-03-2010, 04:25 AM
  4. Search and return values in a range Group
    By mrdata in forum Excel Programming / VBA / Macros
    Replies: 27
    Last Post: 02-21-2008, 05:31 PM
  5. formula to look up and return smallest date from a range of dates
    By BJ in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 12-07-2005, 06:40 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