+ Reply to Thread
Results 1 to 12 of 12

Ceiling function help

  1. #1
    Registered User
    Join Date
    06-17-2008
    Posts
    16

    Ceiling function help

    Hi All,

    I am currently using the formula below to calculate 10% of a total, it rounds up to the nearest whole number to ensure that at least one spare part is supplied.

    =CEILING((F193*0.1),1)

    Is there a way to change this to give an output of 3 as a minimum or 10%? Currently if I input 8 the calculation gives me a result of 1, if I input 30 I get a result of 3. I need to ensure that the result is at least 3.

    thanks for your help
    Last edited by danjstock; 04-20-2010 at 09:25 AM.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Ceiling function help

    How about?

    =IF(F193<30,3,CEILING((F193*0.1),1))
    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
    Registered User
    Join Date
    06-17-2008
    Posts
    16

    Re: Ceiling function help

    That is fantastic, thanks!

    Is there anyway to make the result 0 if the input value is 0?

  4. #4
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Ceiling function help

    =if(f193=0,0,IF(F193<30,3,CEILING((F193*0.1),1)))

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Ceiling function help

    Might be worth encasing within say N and testing <= 0 given CEILING would otherwise fail (negatives)

    =IF(N(F193)<=0,0,MAX(3,CEILING(F193*0.1,1)))

  6. #6
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Ceiling function help

    I think an error message for a negative number might actually be a good thing rather than trying to intercept it with a more complex formula.

    There are situations where users may actually have to do some quality checking themselves. Not every data entry error needs to be intercepted by the formula.

    In this case, if the user enters a negative number, the error message would point them to the fact that something about the entered number might be wrong. Using the N() function and using the <= will allow the user to happily enter wrong data and still not be made aware of it.

  7. #7
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Ceiling function help

    Well, that's certainly a theory...

  8. #8
    Registered User
    Join Date
    06-17-2008
    Posts
    16

    Re: Ceiling function help

    Thanks for the formula, I am going to go with the error message as it will force the user to check the entry they have made.

    How do I mark a question as solved?

    Thanks

  9. #9
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Ceiling function help

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save

  10. #10
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Ceiling function help

    Click Edit on your first post, Go Advanced and change Prefix on Title to Solved.

    As for the error - sure thing though if error notification is important you could consider using Data Validation if you wish to enforce numeric entry in the first instance [within specified boundaries].

  11. #11
    Forum Expert teylyn's Avatar
    Join Date
    10-28-2008
    Location
    New Zealand
    MS-Off Ver
    Excel 365 Insider Fast
    Posts
    11,372

    Re: Ceiling function help

    using Data Validation if you wish to enforce numeric entry
    ... in which case the N() and <= become obsolete, too.

  12. #12
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Ceiling function help

    Agreed.

    However, my point was/remains - if trapping the error visibly is warranted then using Validation is arguably the more logical approach (pref. to Conditional Formatting).

    In cases where such a visible flag is not warranted (as presumed [incorrectly] here by me) - and instead one wants only a default value - then in such cases the use of N and <= is likely to be sufficient ... where precedents are formulae it would not be.

+ 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