+ Reply to Thread
Results 1 to 5 of 5

IF STATEMENT returns False, even though the results are true

  1. #1
    Registered User
    Join Date
    10-28-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    1

    Angry IF STATEMENT returns False, even though the results are true

    I was given the responsibility of tracking vacation time accrual when I started this position. Since there was no system in place to do so, I went about building one. The formula I'm currently working on is the last piece of the puzzle.



    Basically, I’m trying to set up a way for this spreadsheet to account for Vacation time carryover. I am attempting to accomplish this by using an IF formula. Column F is a “ticker” that subtracts the Column C(modified version of the person’s start date) from Column G(today’s date) to produce how many days into their Anniversary year they are in, to accurately track their accrual.


    I’ve come up with several different formulas, and it seems that some are turning up incorrect values.

    excelscreenshot.png


    In the screenshot above, you’ll see the formula in cell D17 indicates that if F17<=365, return the value of F17, but if false, return F17-365.

    The problem is, cell F17 IS less than or equal to 365, it’s 319, which means the value it should spit out is 319, and not -49.

    In a later incarnation of this spreadsheet, I tried adding an extra column with the number 365... see below:
    excelscreenshot.png

    The formulae are still producing false positives. See the screenshot. The formula I used, =IF(G13<=F13,G13, G13-F13), worked in cell D13,where G13 was not in fact less than or equal to 365. But just below it, in cell D14, you’ll notice that G14 IS less than or equal to 365. Yet excel is telling me that it’s not. Any thoughts?

  2. #2
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: IF STATEMENT returns False, even though the results are true

    Hi and welcome to the forum

    column F look to be text, not values, test with =isnumber(cell-ref) FALSE indicates text

    Also, please do not upload a picture of your file...rather, upload a sample of your workbook, showing what data you are working with, a few samples of your expected outcome is (manually entered is ok) and how you arrived at that. (exclude sensitive info). Pictures are pretty much impossible to edit, and no-one wants to re-type your data for you Also, not all members can upload picture files (Company firewalls and stuff)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  3. #3
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    2016
    Posts
    14,675

    Re: IF STATEMENT returns False, even though the results are true

    F17 is probably treated as a text value and as such excel will deem it to be > than any number - do you have formulas in column F returning those values?

    You can try converting to a number within the formula like this

    =IF(F17+0<365,......
    Audere est facere

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: IF STATEMENT returns False, even though the results are true

    Your values in column F are not really numbers, they are "Numbers stored as text"
    As evidenced in your screenshot where it shows the Value_if_true part - F17 = "319"
    Quote marks indicate TEXT.
    Text values are considered Greater than Numbers.

    To resolve,
    Copy a blank cell
    Highlight Column F
    Right Click - Paste Special - Values - Add- OK

  5. #5
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: IF STATEMENT returns False, even though the results are true

    I can't say for sure based on a screenshot instead of a sample worksheet, but based on
    1) the fact column F is left-aligned
    2) that the IF is calling it "319" with the double quotes instead of just a number,

    Indicates to me that you've got something screwy going on where it's getting assessed as text?

    Wrap whatever's in F with the VALUE() function, maybe that will fix it.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 5
    Last Post: 12-09-2012, 11:04 PM
  2. InStr function returns pseudo True/False?
    By GCW esq in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-04-2012, 08:00 AM
  3. Replies: 14
    Last Post: 06-27-2012, 04:26 PM
  4. [SOLVED] Function that compares dates and returns TRUE or FALSE
    By Emily in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 07-25-2006, 04:30 PM
  5. [SOLVED] My If statement results in False when actually true
    By papa jonah in forum Excel General
    Replies: 7
    Last Post: 03-17-2005, 08:06 PM

Tags for this Thread

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