+ Reply to Thread
Results 1 to 11 of 11

more than 1 cell as search range: result is wrong

  1. #1
    Registered User
    Join Date
    04-06-2009
    Location
    USA
    MS-Off Ver
    2007
    Posts
    35

    more than 1 cell as search range: result is wrong

    hello,
    i've been using an IF function in order to display a certain value when one or more criteria are met in one cell in one specific worksheet. here's how it looks like:
    =IF(OR(ISNUMBER(SEARCH("value1",Worksheet1!A1)),ISNUMBER(SEARCH("Value2",Worksheet1!A1))),"yes","no")
    with different values and names.. but it's just to give you the idea of what kind of function it is.
    this one works perfectly, but i also needed another one in which the logical test range is no longer only one cell, but more, thus a selection. i wrote the same formula, but instead of the "A1" i wrote for example "A1:A20" which i thought it would work.. but it doesn't. even more surprising, when i open the insert function (the helping wizard that pops up when i click the "fx" button on the left of the function string) and i put in the logical test, at the bottom of the window it says the correct result (ie: yes). but on the actual worksheet, the cell displays the wrong result (no). i know there are no errors in the formula, so i really don't know how to solve the problem.
    any help will be greatly appreciated
    andrea
    Last edited by NBVC; 04-09-2009 at 01:11 PM.

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

    Re: more than 1 cell as search range: result is wrong

    Perhaps?

    Please Login or Register  to view this content.
    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
    Registered User
    Join Date
    04-06-2009
    Location
    USA
    MS-Off Ver
    2007
    Posts
    35

    Re: more than 1 cell as search range: result is wrong

    it gives me an error when i type it in in that way. not sure if it's about the asterisks or the MATCH instead of the SEARCH. what's the difference?

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

    Re: more than 1 cell as search range: result is wrong

    The * is a wildcard and used when you want to find a string within a string...

    is Value a number or text... if it is a number then you can't use the wildcard and you can't use the quotations.

  5. #5
    Registered User
    Join Date
    04-06-2009
    Location
    USA
    MS-Off Ver
    2007
    Posts
    35

    Re: more than 1 cell as search range: result is wrong

    actually I have a lot of conditions. some of them are numbers, some are words, and some are combination of letters and numbers.
    if you give me instructions, i can match every case with the correct wildcard character, maybe

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

    Re: more than 1 cell as search range: result is wrong

    Supply a sample workbook showing your expectations.

  7. #7
    Registered User
    Join Date
    04-06-2009
    Location
    USA
    MS-Off Ver
    2007
    Posts
    35

    Re: more than 1 cell as search range: result is wrong

    I'm not able to transfer the workbook on this computer. I will try to explain you what I'm looking for.
    This cell in which i'm typing the formula is supposed to display "yes" when one of the value (numbers or letters) listed in the logical test is found in the cell range A1:A10, in the other worksheet.
    this formula
    =IF(OR(ISNUMBER(SEARCH("value1",Worksheet1!A1)),ISNUMBER(SEARCH("Value2",Worksheet1!A1))),"yes","no" )
    worked fine when the range was one single cell (A1) but it doesn't when I substitute the single cell with a range of cells (A1:A20). maybe i'm typing the range wrongly, because the logical test worked perfectly before, and i haven't changed it.
    i hope i explained myself.. thanks for the support

  8. #8
    Registered User
    Join Date
    04-06-2009
    Location
    USA
    MS-Off Ver
    2007
    Posts
    35

    Re: more than 1 cell as search range: result is wrong

    here are some examples of the conditions to be searched in the range:
    OVC005
    BKN010
    VV
    3000
    4500
    1SM
    2 1/2SM

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

    Re: more than 1 cell as search range: result is wrong

    Try:

    Please Login or Register  to view this content.
    or

    Please Login or Register  to view this content.

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

    Re: more than 1 cell as search range: result is wrong

    If you want to search for any/all of those conditions and you have them listed in a separate range, say in X1:X10, then you should use:

    =IF(SUMPRODUCT(--(ISNUMBER(MATCH(A1:A20,X1:X10,0)))),"yes","no")

  11. #11
    Registered User
    Join Date
    04-06-2009
    Location
    USA
    MS-Off Ver
    2007
    Posts
    35

    Re: more than 1 cell as search range: result is wrong

    it seems to work with the asterisks. thanks!!

+ 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