+ Reply to Thread
Results 1 to 8 of 8

IF Formula not giving expected results.

Hybrid View

  1. #1
    Registered User
    Join Date
    11-09-2010
    Location
    Seattle, Washington
    MS-Off Ver
    excel 2010
    Posts
    14

    IF Formula not giving expected results.

    I have a column that gets dollar amounts added to it via data import (892.38 as an example). Another column has the following formula in it that I'm having a hard time with.

    =IF(AO4=0, AW4, AO4)
    basically if the value is not a zero, then set the cell with formula equal to that number. If it is a zero, then set the cell's value equal to the value in cell AWxx.......

    The data gets imported fine, and the formula works for cells where AOxx has a non zero value. For cells with a value of zero, it returns zero to the cell with the formula.

    The odd thing is that when I click in one of the AOxx cells with a zero value, and click up in the formula bar, then click out of the cell, it evaluates the formula properly and returns the value in column AWxx because the value is now equal to zero.

    This is very strange to say the least. I was beginning to think my data import was padding a space to the front of the zero value in column AOxx........

    so...how do I get the formula to evaluate as it should without having to click in each cell of column AOxx that has a zero value in it?
    Last edited by fungus; 11-17-2010 at 12:49 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: Formula help

    Your post does not comply with Rule 1 of our Forum RULES. Your post title should accurately and concisely describe your problem, not your anticipated solution. Use terms appropriate to a Google search. Poor thread titles, like Please Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will be addressed according to the OP's experience in the forum: If you have less than 10 posts, expect (and respond to) a request to change your thread title. If you have 10 or more posts, expect your post to be locked, so you can start a new thread with an appropriate title.
    To change a Title on your post, click EDIT then Go Advanced and change your title, if 2 days have passed ask a moderator to do it for you.

    PLEASE PM WHEN YOU HAVE DONE THIS AND I WILL DELETE THIS POST
    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
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,088

    Re: Formula help

    I suspect that the cells/column are formatted as text.

    Put a 1 in a "spare" cell and copy it.
    Then select all the data in the AO column.
    Choose Paste Special and select the Multiply Operation.
    Delete the 1 in the "spare" cell.

    If that was the problem, all the "numbers" will now be, well, numbers.

    Regards
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,088

    Re: Formula help

    @NVBC: oops, done it again. Apologies ... drafting my response in the background. :-(

  5. #5
    Registered User
    Join Date
    11-09-2010
    Location
    Seattle, Washington
    MS-Off Ver
    excel 2010
    Posts
    14

    Re: Formula help

    A little more info on this issue.....

    the data in colum AO that has zeros is displayed as "0". Once I click in the cell, then in the formula bar, then out again, the value changes to "0.00", and the value in column AX (where the formula is) gets updated accordingly........what is going on here?

  6. #6
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,088

    Re: IF Formula not giving expected results.

    It seems that, when you import data, it arrives in cells that are treated as text.

    It's difficult to tell without seeing the workbook (after the import but before you make any changes to the data).

    Going into the cell and pressing enter is, effectively, typing a numeric value into the cell and, hence, getting a numeric format ... and formulae that work.

    Regards

  7. #7
    Registered User
    Join Date
    11-09-2010
    Location
    Seattle, Washington
    MS-Off Ver
    excel 2010
    Posts
    14

    Re: IF Formula not giving expected results.

    Copying the 1 from another cell and doing the "paste special" trick worked......now...the bigger issue is why would a column coming from a SQL Database, that is selected out as a "decimal" data type be converted to text by the time the data is run from an Access Query that is then queried from Excel.......

    This is a really strange formatting issue. I'm not used to dealing with this crap in real RDBMS's like SQL.......what is selected comes out as selected.....

  8. #8
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,088

    Re: IF Formula not giving expected results.

    Désolé. Je ne sais pas. :-(

+ 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