+ Reply to Thread
Results 1 to 5 of 5

Check for values greater than zero in 2 cells

  1. #1
    Registered User
    Join Date
    11-03-2008
    Location
    VANCOUVER
    Posts
    5

    Check for values greater than zero in 2 cells

    I can"t seem to remember how to compare 2 cells before doing a calculation. Please Help:

    Let's say I want to divide the numbers from 2 cells, down a long column. Let's further say that in some instances there aren't any numbers in either of the cells. You get a divide by zero error.

    So you have values in a1 and b1 through a10 and b10. You want to divide the value in the a column by the value in the b column and return the answer in the adjacent c column. You've copied the formula all the way down to c20.

    All the cells from c11 to c20 will have divide by zero errors.

    What is the syntax to check if both cells in columns a and b are greater than zero so that either an answer will be returned or just a blank cell will result, (when nothing is in one of the cells from a or b?

    The following formula works for checking the status of cell A, how do I also check the value in cell B?
    =(IF(A5>0,A5/B5,""))

    something like?:
    =(IF(A5>0 and B5>0,A5/B5,""))
    Last edited by oldchippy; 11-04-2008 at 04:06 AM.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Welcome to the forum, try something like this

    =IF(AND(A5>0,B5>0),A5/B5,"")
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    11-03-2008
    Location
    VANCOUVER
    Posts
    5
    Oldchippy....

    That works if either or both cells are blank, but if they both have values, then the div/zer error is back.

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    It works OK for me, can you tell me what numbers you have in A5 and B5?

  5. #5
    Registered User
    Join Date
    11-03-2008
    Location
    VANCOUVER
    Posts
    5
    My oppologies.... I was working in a different cell range. It does work fine....... thank you very much.

+ 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