+ Reply to Thread
Results 1 to 4 of 4

Excel 2007 : Returning wrong value with IF function

  1. #1
    Registered User
    Join Date
    06-27-2011
    Location
    N/A
    MS-Off Ver
    Excel 2007
    Posts
    4

    Question Returning wrong value with IF function

    I have two separate functions I am using in different cells but in the same column. I L17 cell I am referencing contains the value 3.0. I want the first function to return the true value of 2 because the >=3 is equal to 3.0. However, the next cell down also returns its true value of 1 even though I specified only to return 1 if it is <3, not <=3.

    =IF(L17>=3,2,0) --- returns 2 correctly

    =IF(OR(L17>1,L17<3),1,0) --- returns 1 (wrong!)

    Please help!

    Thank you!

  2. #2
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Returning wrong value with IF function

    Is the value in L17 a number or a string looking like a number?

  3. #3
    Valued Forum Contributor scottylad2's Avatar
    Join Date
    09-03-2010
    Location
    edinburgh
    MS-Off Ver
    Office 2007 Prof & Office 2010 Student Edition
    Posts
    629

    Re: Returning wrong value with IF function

    If the value in L17 is 3.0, the first argument in the Or part of your =IF(OR(L17>1,L17<3),1,0) is correctly going to return 1 as 3.0 is greater than 1. The Or function is basically saying if argument 1 is TRUE OR argument Two is TRUE, return 1.

    What you have is correctly showing 1. If you need it to show something else then maybe it needs to showL17=1 or something?
    Windows 7 using Office 2007 & 2010

    Remember your [ code ] [ /code ] tags, makes reading soooo much easier

  4. #4
    Registered User
    Join Date
    06-27-2011
    Location
    N/A
    MS-Off Ver
    Excel 2007
    Posts
    4

    Re: Returning wrong value with IF function

    authorbr, L17 is just the value 3.0 manually entered.

    Scottylad2, thanks to your response, I figured out that it should be an AND function instead of OR. My hard copy document I was referring to had OR incorrectly written in the cell instead of AND.

+ 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