+ Reply to Thread
Results 1 to 18 of 18

round values formula excel

  1. #1
    Registered User
    Join Date
    07-13-2020
    Location
    Katowice
    MS-Off Ver
    2010
    Posts
    8

    round values formula excel

    Hello,

    how to round (using 1 formula) with original values ​​from column A to values ​​equal to those in column B. My not 100% good proposition in column C.

    BR
    beblak
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor
    Join Date
    04-24-2020
    Location
    Woodbridge, VA
    MS-Off Ver
    2016
    Posts
    434

    Re: round values formula excel

    How about just =ROUND(A2,2)

  3. #3
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: round values formula excel

    I do not see the problem. I assume that somewhere along the line, you were seeing C12 return 0.18, but C12 is returning 0.19 when I open your file. Can you explain a little more about your problem? Where/when is it failing? Have you checked calculation to make sure it is automatic?
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  4. #4
    Registered User
    Join Date
    07-13-2020
    Location
    Katowice
    MS-Off Ver
    2010
    Posts
    8
    Using the function (maybe it will not be just a rounding function) I would like to get the results according to column B based on the value in column A, I proposed a rounding function in column C, but this is not a formula that reflects the expected value in 20/20 cases. The row for which there is no value coverage is different from 0 in column D (comparative column). Correctly proposed function will display only zeros in column D. I can extend the spreadsheet if necessary with further data. I see a relationship, but I can't describe it with a formula.

  5. #5
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: round values formula excel

    In your sample file, column D does not contain a formula. If I replace the values in column D with =D2-C2 (copied down), all of column D returns 0 -- including C12, which your sample file claims would return -0.01. Do you have more examples where it fails? Have you checked for things (like calculation setting) that would be specific to your installation of Excel?

  6. #6
    Registered User
    Join Date
    07-13-2020
    Location
    Katowice
    MS-Off Ver
    2010
    Posts
    8

    Re: round values formula excel

    Exactly, the value in C12 returns -0.01 which means there is a mismatch and the formula I propose is not correct. I suspect that this may not be possible with other round-off formulas, and this requires a more complex function.

    I attach a file with more sample data.

    BR
    Attached Files Attached Files

  7. #7
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: round values formula excel

    Your two sample files do not appear to be consistent, so I wonder if there is a typo in one of them.

    In your original sample file, you appear to be using standard arithmetic rounding where you round half up. Your example of 0.185 in your original sample file is shown rounding up to 0.19. The formula you proposed in the OP round 0.185 up to 0.19.

    In this new sample file, you appear to be using banker's rounding where you round half to even. You are now showing 0.015 rounding up to 0.02 and 0.025 rounding down 0.02. It will help us help you if you are clear and consistent in describing your problem.

    Excel's built in rounding algorithm is the standard arithmetic "round half up" algorithm. However, VBA's built in rounding algorithm is banker's rounding. I usually think that the easiest way to implement banker's rounding in Excel is to use a VBA user-defined function. See example and discussion here (including a non-VBA solution): https://www.excelforum.com/excel-for...-rounding.html Of course, if you put something like "banker's rounding excel" into your favorite search engine, you should find more tutorials and discussions.

    Are we getting closer to understanding the question?

  8. #8
    Registered User
    Join Date
    07-13-2020
    Location
    Katowice
    MS-Off Ver
    2010
    Posts
    8

    Re: round values formula excel

    Yes, we are getting closer to understanding the question. Thank you MrShorty for your willingness to help.

    You are now showing 0.015 rounding up to 0.02 and 0.025 rounding down 0.02
    Non-standard rounding occurs for numbers that end in 5 and the digit preceding it is even. (x.x05, x.x25, x.x45, x.x85). This is the rule of that strange rounding that I noticed. In all other cases, rounding is standard arithmetic "round half up" algorithm.

    Can you do this with if function? IF numbers end in 5 AND the digit preceding 5 is even THEN round down, ELSE round up

  9. #9
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: round values formula excel

    Please show the expected results manualy in your file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  10. #10
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,899

    Re: round values formula excel

    Try this

    =ROUND(A2,2)-OR(MOD(A2*1000,100)={5,25,45,65,85})*0.01

  11. #11
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: round values formula excel

    An IF() function might be useful. It's hard to say, since I'm not sure of the actual rounding rule we are using. We can keep guessing at formulas if you want but they're just guesses until we get a good description of the rounding algorithm.

    You say it's not regular rounding and you didn't seem to like banker's rounding. Now you have some vague idea about even and odd-- but not banker's rounding. Let's pin down the desired algorithm, then we can work out s formula.

  12. #12
    Registered User
    Join Date
    07-13-2020
    Location
    Katowice
    MS-Off Ver
    2010
    Posts
    8

    Re: round values formula excel

    Quote Originally Posted by oeldere View Post
    Please show the expected results manualy in your file.
    hi, attached the file

    BR
    Attached Files Attached Files

  13. #13
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: round values formula excel

    It still looks like banker's rounding to me, and, as I noted in the other thread, I think a VBA UDF is the easiest way to implement banker's rounding in Excel. Are you allowed to use a VBA UDF for this, or do we need to come up with a native Excel way to implement banker's rounding?

  14. #14
    Registered User
    Join Date
    07-13-2020
    Location
    Katowice
    MS-Off Ver
    2010
    Posts
    8
    Quote Originally Posted by MrShorty View Post
    It still looks like banker's rounding to me, and, as I noted in the other thread, I think a VBA UDF is the easiest way to implement banker's rounding in Excel. Are you allowed to use a VBA UDF for this, or do we need to come up with a native Excel way to implement banker's rounding?
    I prefer the option without using VBA

    BR

  15. #15
    Registered User
    Join Date
    07-13-2020
    Location
    Katowice
    MS-Off Ver
    2010
    Posts
    8

    Re: round values formula excel

    Quote Originally Posted by Phuocam View Post
    Try this

    =ROUND(A2,2)-OR(MOD(A2*1000,100)={5,25,45,65,85})*0.01
    this formula does not work unfortunately

  16. #16
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,811

    Re: round values formula excel

    Adapting the formula proposed here: https://www.excelarticles.com/excelb..._astm_e29.html
    =IF(MOD(100*A2,1)=0.5,MROUND(100*A2,2),ROUND(100*A2,0))/100 or some equivalent variation (needs to account for both floating point errors as well as the banker's rounding) should work.

  17. #17
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,899

    Re: round values formula excel

    Quote Originally Posted by beblak View Post
    this formula does not work unfortunately
    It worked for me.
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    07-13-2020
    Location
    Katowice
    MS-Off Ver
    2010
    Posts
    8

    Re: round values formula excel

    Quote Originally Posted by Phuocam View Post
    It worked for me.
    actually works, I used a different version of "{5 \ 25 \ 45 \ 65 \ 85}" that's it!

    THANK YOU

+ 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. how to round a formula in excel
    By rubusmubu in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 05-18-2016, 04:59 AM
  2. [SOLVED] How to round to preset values in Excel?
    By noobsaibot in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-26-2013, 01:29 AM
  3. Formula to Round off Values
    By kamalthakur in forum Access Programming / VBA / Macros
    Replies: 1
    Last Post: 03-17-2010, 11:17 AM
  4. Round off values in Excel
    By harshaputhraya in forum Excel General
    Replies: 7
    Last Post: 05-14-2006, 07:39 PM
  5. formula for parenthesis round negative money values in excel
    By jeff in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-14-2006, 02:45 AM
  6. [SOLVED] Formula to enter to round an Excel value up to the next $0.5?
    By Lee in forum Excel General
    Replies: 1
    Last Post: 01-04-2006, 06:55 PM
  7. [SOLVED] how do I round up a result of a formula in Excel
    By one of two in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-02-2005, 12:25 PM

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