+ Reply to Thread
Results 1 to 17 of 17

IF-OR formulla

  1. #1
    Registered User
    Join Date
    05-24-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    IF-OR formulla

    Can someone please help me in creating a formula for cell A3 that does the following:

    IF A1-A2 is less than 0, return 0 OR If A1-A2 is more than 0, round up to the closest whole number and divide by 10.

    Thanks!

  2. #2
    Registered User
    Join Date
    06-20-2012
    Location
    Melbourne Australia
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: IF-OR formulla

    Hello Scott,

    Does this give you the correct results?

    =IF(A1-A2<0,0,ROUND(A1-A2,-1)/10)

    Diana

  3. #3
    Registered User
    Join Date
    05-24-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: IF-OR formulla

    Let me give it a try now and let you know. Thanks for such a quick response, Diana.

  4. #4
    Forum Contributor bentleybob's Avatar
    Join Date
    02-27-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    644

    Re: IF-OR formulla

    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    05-24-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: IF-OR formulla

    It worked when the number came out less than 0 but in instances where the result is more than 0, the cell still shows 0.

    Test 1: A1=14 A2=30
    Test 2: A1=30.6 A2=30

  6. #6
    Registered User
    Join Date
    05-24-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: IF-OR formulla

    My last reply was to Diana. Let me give your formula a try now bentlybob.

  7. #7
    Registered User
    Join Date
    05-24-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: IF-OR formulla

    Bob, test 1 worked fine. Test 2 returned .1 How would I make the formula return only whole numbers? In this case it should be 1.

  8. #8
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: IF-OR formulla

    try
    =ROUND(MAX(0,A1-A2),0)/10

    edit: the answer is not 1 as stated above it should be .1 because you have to divide 1 by 10 as per your request to divide by ten , isn't?
    I think people forget the word "THANK YOU!!!!" Do you still know it???

    There is a little star ( ADD REPUTATION ) below those person who helped you. Click it to say your "PRIVATE APPRECIATION TO THEIR EFFORT ON THEIR CONTRIBUTIONS "

    Regards,
    Vladimir

  9. #9
    Registered User
    Join Date
    05-24-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: IF-OR formulla

    Hi Vlady. Thanks for the reply. I'm getting the same results as I did with bentlybob's formula. If A1=30.6 and A2=30, I get .1 It should be 1.

  10. #10
    Registered User
    Join Date
    06-20-2012
    Location
    Melbourne Australia
    MS-Off Ver
    Excel 2010
    Posts
    75

    Re: IF-OR formulla

    Try =IF(A1>A2,ROUND(A1-A2,-1)/10,0)

    Diana

  11. #11
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: IF-OR formulla

    if you expect the result's as whole number in this case you should delete the /10 in their/my formula

    in your first post.
    , round up to the closest whole number and divide by 10.
    if A1-A2 is greater than or equal 10 then your get whole number if you divide by ten, if lower than 10 then the answers will all be decimals.

  12. #12
    Registered User
    Join Date
    05-24-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: IF-OR formulla

    For clarification, if A1-A2= a figure between 30.1 and 40, the answer should be 1. If the figure is between 40.1 and 50, the answer should be 2, and so on.
    Thanks.

  13. #13
    Forum Contributor bentleybob's Avatar
    Join Date
    02-27-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    644

    Re: IF-OR formulla

    Yes, even if you use ROUNDUP, it rounds to 1 and then, when you divide by 10, you get .1. Perhaps you want the rounding up done AFTER you divide by 10?
    Please Login or Register  to view this content.
    This appears to satisfy your latest clarification.
    Last edited by bentleybob; 06-21-2012 at 11:23 PM.

  14. #14
    Registered User
    Join Date
    05-24-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: IF-OR formulla

    bentlybob your formula is working when A1=30.6 and A2=30 but when A1=14 and A2=30 I'm getting a "FALSE"

  15. #15
    Forum Contributor bentleybob's Avatar
    Join Date
    02-27-2009
    Location
    Seattle, WA
    MS-Off Ver
    Excel 2010
    Posts
    644

    Re: IF-OR formulla

    Oops, sorry. Forgot the last piece.
    Please Login or Register  to view this content.

  16. #16
    Registered User
    Join Date
    05-24-2012
    Location
    Florida
    MS-Off Ver
    Excel 2007
    Posts
    18

    Re: IF-OR formulla

    We have a winner! Thanks to all for your help.

  17. #17
    Forum Moderator vlady's Avatar
    Join Date
    09-22-2011
    Location
    Philippines - OLSHCO -Guimba-Nueva Ecija
    MS-Off Ver
    2021
    Posts
    4,366

    Re: IF-OR formulla

    @ scott
    so divide it first before rounding.. not round then divide as you stated in the first post...you can do it also to the other formulas given above.

    thanks for the rep also.

+ 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