+ Reply to Thread
Results 1 to 5 of 5

Search column for three items

  1. #1
    Registered User
    Join Date
    06-04-2011
    Location
    Bethlehem, PA
    MS-Off Ver
    Excel 2008
    Posts
    3

    Search column for three items

    I have a column B5:B26 and I would like to search it for R1, R2, and R3. If one of them is present in the column, I want that value in the cell. i.e. "R1" or "R2" or "R3". If there is no R1,R2, R3, then I would like nothing in the cell. The column will only ever have one of the three values or nothing. I have spent hours on this....

  2. #2
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Search column for three items

    Hello, Try

    =IFERROR(LOOKUP(9E+300,1/ISNUMBER(MATCH(R1:R3,B5:B26,0)),{"R1","R2","R3"}),"")

    EDIT:

    Just realize, you can use simply,

    =IFERROR(LOOKUP(9E+300,MATCH(R1:R3,B5:B26,0),R1:R3),"")
    Last edited by Haseeb Avarakkan; 06-07-2011 at 01:47 AM. Reason: Simplify the formula
    Regards,
    Haseeb Avarakkan

    __________________________________
    "Feedback is the breakfast of champions"

  3. #3
    Registered User
    Join Date
    06-04-2011
    Location
    Bethlehem, PA
    MS-Off Ver
    Excel 2008
    Posts
    3

    Re: Search column for three items

    I did try the formulas. The first returns a ##. The second did not return anything to the cell when I entered a R1, R2, R3 to any of the cells in B5:B26.

  4. #4
    Forum Guru
    Join Date
    05-24-2011
    Location
    India
    MS-Off Ver
    Office 2021
    Posts
    2,237

    Re: Search column for three items

    Are you saying, you want to search "R1", "R2", "R3" values, not the values in R1, R2, R3 cells, if so tr this

    =IFERROR(LOOKUP(9E+300,MATCH({"R1";"R2";"R3"},B5:B26,0),{"R1";"R2";"R3"}),"")

    Could you please attach a dummy file? So we can see the data.

  5. #5
    Registered User
    Join Date
    06-04-2011
    Location
    Bethlehem, PA
    MS-Off Ver
    Excel 2008
    Posts
    3

    Re: Search column for three items

    That works. I broke down the original formula you gave me and came up with this:=IF(ISERROR(INDEX(B4:B25,MATCH("r?",B4:B25,0),1)),"",INDEX(B4:B25,MATCH("r?",B4:B25,0),1)) This seems to work also. Will this type cause problems? Your formula looks easier. Could you explain the Lookup portion. Why does the value have to be such a large number? I under stand the position returned by the Match formula. How does the array work in the result range? If this is too many questions is there a good book or site to read on this? I did attach a file of the problem. B38 was my solution, B39 your, B40 & B41 the progression to figuring this out. Thank you so much for all of your time.
    Attached Files Attached Files

+ 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