+ Reply to Thread
Results 1 to 7 of 7

Excel 2007 : Nested Search Formula

  1. #1
    Registered User
    Join Date
    02-07-2011
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2007
    Posts
    3

    Nested Search Formula

    Hello All,

    I am working on a formula to search a cell and based on 3 possible findings insert one of 3 possible responses in another cell. I am not very good with VBA and would like to stay in a formula if possible.

    The cell i am searching will have one of three, three letter codes randomly spaced in the cell. (ie Doe, John F STF Annapolis MD 2344; Scott, Michael T MGR Tampa FL 1558, or Johnson, Bob E CTR Baltimore, MD 3399) It will be either STF, MGR, or CTR.

    I would like to put the value corisponding to the three letter code in another cell.

    Any ideas would be greatly welcome.

    Thanks,
    Kenn

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Nested Search Formula

    What is the value you are putting in the "other" cell?
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Nested Search Formula

    If we assume string is A1

    Please Login or Register  to view this content.
    modify the result_vector responses as desired

  4. #4
    Registered User
    Join Date
    02-07-2011
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Nested Search Formula

    NBVC
    The value that would be filled into the new cell would be either STF,MGR, or CTR.


    Donkey
    what is the 9.99E+307 for in your code snippet.

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Nested Search Formula

    It is a big number 9.99*10^307

    Used in this context it ensures LOOKUP returns the value from the result_vector associated with the last numeric value found in the lookup_vector

    Brief overview: http://www.excelforum.com/2466052-post12.html - though this is aimed at the text equivalent the same principles hold true for this numeric version

  6. #6
    Registered User
    Join Date
    02-07-2011
    Location
    Baltimore, MD
    MS-Off Ver
    Excel 2007
    Posts
    3

    Re: Nested Search Formula

    Cool thanks for the knowldege and the formula works like a charm. Can i add criteria to it just by adding another search definition and response?

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Nested Search Formula

    Yes, if you have lots of items it would probably make more sense to store them (and responses) in a range and alter the formula accordingly, eg:

    Please Login or Register  to view this content.
    where C1:C10 hold search terms (* in C1) and D1:D10 associated responses (="" in D1)

    the use of INDEX & REPT is just to account for possibility that C1:C10 may contain blanks (to be ignored)

+ 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