+ Reply to Thread
Results 1 to 4 of 4

Rounding in IF statements

  1. #1
    Registered User
    Join Date
    08-08-2012
    Location
    Edmonton, AB
    MS-Off Ver
    Excel 2003
    Posts
    2

    Rounding in IF statements

    How would I write a formula that includes the following three stipulations?

    If C3 < 0.5: round to the nearest 0.1
    If C3 > or = 0.5 to < or = 5.0: Round to the nearest 0.5
    If C3 > 5: round to the nearest 1

  2. #2
    Forum Expert daddylonglegs's Avatar
    Join Date
    01-14-2006
    Location
    England
    MS-Off Ver
    Microsoft 365
    Posts
    14,736

    Re: Rounding in IF statements

    Try this formula

    =IF(C3<0.5,ROUND(C3,1),IF(C3>5,ROUND(C3,0),ROUND(C3*2,0)/2))
    Audere est facere

  3. #3
    Registered User
    Join Date
    08-08-2012
    Location
    Edmonton, AB
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Rounding in IF statements

    that formula works great! however my only problem is that it doesn't keep the decimal places if it rounds to a whole number for the second stipulation. for example it rounds 2.183 to 2 instead of 2.0. is there any way to fix that?

  4. #4
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Rounding in IF statements

    It does round 2.183 to 2.0 instead of "2"; you want to fix something that isn't broken.

    But you haven't set the cells to display that. (I hazard to guess you've left it the cell format as "general", which omits trailing zeros).

    Right click => cell format=> number: 1 decimal place

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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