+ Reply to Thread
Results 1 to 14 of 14

IF statement to return 0 if 0 in cell if not return formula

Hybrid View

  1. #1
    Registered User
    Join Date
    10-18-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: IF statement to return 0 if 0 in cell if not return formula

    Quote Originally Posted by Pete_UK View Post
    Actually, you also need to remove the second AND, and you can get rid of some of the brackets, like this:

    Formula: copy to clipboard
    IF(AND(C7=0,F7=0),0,IF(C7>=1,(F7-C7)/C7,F7/F7))


    Hope this helps.

    Pete
    Hi Pete

    Yes that helps and returns a zero value if the cells are zero, but does not bring back correct calc value if populated with numbers.

    EG if C7 was 19 and F7 was 18 the calc would return -5.26% but using the formula above it returns 100%

    Any Ideas ?

    Thanks
    CraigieL

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: IF statement to return 0 if 0 in cell if not return formula

    So, is C7 a numeric value or a text value that looks like a number? Put =ISTEXT(C7) in an empty cell somewhere.

    Pete

  3. #3
    Registered User
    Join Date
    10-18-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: IF statement to return 0 if 0 in cell if not return formula

    C7 and F7 are numeric Pete

    Hope this helps

    Thanks
    CraigieL

  4. #4
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: IF statement to return 0 if 0 in cell if not return formula

    Well you can see that the TRUE action for the second IF statement is:

    (F7-C7)/C7

    which should give you -5.26%, so there is something about the comparison

    C7>=1

    that is giving you the FALSE action.

    Are you sure you have typed it correctly?

    Pete

  5. #5
    Registered User
    Join Date
    10-18-2012
    Location
    Scotland
    MS-Off Ver
    Excel 2007
    Posts
    19

    Re: IF statement to return 0 if 0 in cell if not return formula

    Hi Pete

    Yes using the formula as processed

    IF(AND(C7=0,F7=0),0,IF(C7>=1,(F7-C7)/C7,F7/F7))
    But works if cells are 0 but not with values

    Thanks
    CraigieL

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,408

    Re: IF statement to return 0 if 0 in cell if not return formula

    Well, all I can suggest is that you post the workbook here, so I can see what is going wrong.

    Pete

+ 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. statement / formula to return text from a range of cells
    By nellyc in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-30-2013, 07:55 AM
  2. Replies: 20
    Last Post: 04-07-2013, 09:36 PM
  3. If Formula looking at a number of cells to return a statement
    By tylerjam1980 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-22-2012, 11:54 AM
  4. IF statement to return value from another cell.
    By Ghornet54 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-01-2010, 11:32 AM
  5. If statement to return nothing if cell is blank
    By amusn in forum Excel General
    Replies: 5
    Last Post: 10-19-2007, 02:25 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