+ Reply to Thread
Results 1 to 6 of 6

An If statement where the Logical test is true, but returns the False result in the sheet

  1. #1
    Registered User
    Join Date
    04-23-2012
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    10

    An If statement where the Logical test is true, but returns the False result in the sheet

    Hi out there.

    I tried something that I thought shouldn't work, but am getting a strange response.

    I have raised an if statement that attempts to search a range of cells in a single row (i.e. some 20 odd columns of cells) to see if a primary cell in the formula row matches any of the inputted data in my range row. i.e:
    =IF(OR($B53=$D$12:$S$12),0,C53)

    Yes I know that this shouldn't work, according to everything that I know about excel it shouldn't work, but this is my issue:

    The formula, when looking at the function arguement pop-up says that the logical test it TRUE and gives the True Result. The result showing in the particular cell is the FALSE response. The attached photo is this issue, and I am attaching a file that has this issue. I've highlighted the two rows in my data table that the references relate to.

    A picture of the response:
    Excel response.jpg

    The file:
    Book1.xlsx

    Also on the origional file (sorry commercial-in-confidence guys, I can't give this to you) the first test cell reference (i.e. the M159) is also logical test True, returning the false result, as it does for the M119 line in the attached file. In the attached file here, the M159 test is giving the True response.

    I'm confused here. The differing responses are confusing.

    Can anyone please advise:
    1. why excel is showing the false result when the logical test is true and the function arguement screen shows the True result,
    2. why I would get the differing results in the first search term in two different files,
    3. and if there is a way to use the simplified formula to acheive the correct response considering the Function Agrument screen says it should be working?

    Yes I know that I can use the following to get this to work (see cell D34), but the questions above still remains:
    =IF(OR($B34=$D$12,$B34=$E$12,$B34=$F$12,$B34=$G$12,$B34=$H$12,$B34=$I$12,$B34=$J$12,$B34=$K$12,$B34=$L$12,$B34=$M$12,$B34=$N$12,$B34=$O$12,$B34=$P$12,$B34=$Q$12,$B34=$R$12,$B34=$S$12),0,C34)

  2. #2
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: An If statement where the Logical test is true, but returns the False result in the sh

    maybe you could use countif

    =IF(COUNTIF($D$12:$S$12,B35)<>0,0,C35)
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  3. #3
    Registered User
    Join Date
    04-23-2012
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: An If statement where the Logical test is true, but returns the False result in the sh

    Thanks had overlooked the countif function it should work fine, any thoughts on the rest of the question?

  4. #4
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: An If statement where the Logical test is true, but returns the False result in the sh

    =IF(OR($B53=$D$12:$S$12),0,C53) -> this will only look for the first cell it's like

    B53=D12 only regardless of the range it will not look to other cell of the range

  5. #5
    Registered User
    Join Date
    04-23-2012
    Location
    Auckland, New Zealand
    MS-Off Ver
    Excel 2010
    Posts
    10

    Re: An If statement where the Logical test is true, but returns the False result in the sh

    Interesting thanks.

    Also Interesting that the Function Arguement popup notes that the OR statement is working, the second item of data, i.e. the E12 data is returning a TRUE response, that the calculation says true and the final response according to that is True but it shows the False response.

    Very strange.

    Have used the Countif with a greater than rather than a not equal to, works brillantly thanks.

  6. #6
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,361

    Re: An If statement where the Logical test is true, but returns the False result in the sh

    use evaluate formula , you'll see there if it will return the or function correctly.

    edit: btw the or function syntax is ( OR(statement1 , statement2, statement3) ->options are separated by comma
    Last edited by vlady; 12-09-2012 at 11:10 PM.

+ 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