+ Reply to Thread
Results 1 to 9 of 9

Round with given condition

  1. #1
    Registered User
    Join Date
    12-10-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Round with given condition

    Hi, i want to round the output in a cell to the specified condition.
    The condition is:

    if "output in cell" is >x.3 then the output is rounded to x, if the "output in cell" is <x.3 then the output is rounded to x+1
    Help appreciated.

    Thanks,

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

    Re: Round with given condition

    Are you sure it's that way round? Taken literally that will round 5.9 to 5 and 5.1 to 6! Assuming those should be the other way round try this

    =ROUND(A1+0.2,0)
    Audere est facere

  3. #3
    Forum Expert XOR LX's Avatar
    Join Date
    04-18-2013
    Location
    Turin, Italy
    MS-Off Ver
    Office 365
    Posts
    7,742

    Re: Round with given condition

    Hi,

    =INT(B1)+(MOD(B1,1)>0.3)

    You don't mention what the result should be if the output is precisely x.3

    Regards
    Click * below if this answer helped

    Advanced Excel Techniques: http://excelxor.com/

  4. #4
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Round with given condition

    Try this
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    12-10-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Round with given condition

    Hi Daddylonglegs, thanks for pointing our.. yes i put ">" sign wrongly in the query .

    And your solution works well. Thanks,

    What if i want to add another complication to this and would want the following:

    if "output in cell" is <x.3 then the output is rounded to x, if the "output in cell" is >x.3 then the output is rounded to x+1, if the "output in cell" is >0.1 then it is rounded to 1

  6. #6
    Registered User
    Join Date
    12-10-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Round with given condition

    Hi XOR LX and KVSrinivasamurthy, your formula's also work well. ZOR LX's they way i wanted, KVSrinivasamurty's the way i described the query with wrong "<>" signs. Thanks

    Can you help me with the another complication in this formula with this added 3rd complication.

    if the "output in cell" is >0.1 then it is rounded to 1

  7. #7
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,587

    Re: Round with given condition

    Between what values of "output in cell" value should be 1 .

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,938

    Re: Round with given condition

    maybe...
    =if(A1<0.1,1,ROUND(A1+0.2,0)

    I am assuming that again, you have the sign mixed around again?

    If not,
    =if(and(A1>0.1,A1<1),1,ROUND(A1+0.2,0)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  9. #9
    Registered User
    Join Date
    12-10-2011
    Location
    India
    MS-Off Ver
    Excel 2007
    Posts
    25

    Re: Round with given condition

    Hi kvsrinivasamurthy, the complete equation is like this:

    if output in cell is >0.1 then round to "1" which means if the output in cell is <0.1 then round to 0
    if output in cell is <x.3 then the output is rounded to x
    if the output in cell is >x.3 then the output is rounded to x+1
    Hi FDibbins's second code works well and this is what i wanted.

    =if(and(A1>0.1,A1<1),1,ROUND(A1+0.2,0)
    Can you guys help me put this code in VBA function, i basically need to put this round function in many output cells where there is already a sumifs function which needs to be rounded with this new function...?

    Thanks Guys for you help! i am loving this forum more and more.
    Last edited by pnegi; 09-23-2013 at 01:55 AM.

+ 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. [SOLVED] Conditional Round up or Round up Function
    By cdmterence in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 09-18-2013, 06:03 PM
  2. [SOLVED] Is there a way to round this condition to 1 decimal place?
    By brians34 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-19-2013, 10:44 AM
  3. If condition and SUM equation
    By zeez36 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 06-24-2013, 02:14 AM
  4. [SOLVED] Round Price Up or Down to nearest $.99 based on a Condition
    By agent46 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-23-2013, 05:56 PM
  5. [SOLVED] How do I ROUND() round off decimals of a column dataset?
    By H&oslash;jrup in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-12-2005, 07:06 AM

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