Round function in Excel, worksheet function vs VBA

前端 未结 1 1623
感动是毒
感动是毒 2020-12-11 23:06

I had an application for returning closest matches to certain values in a large cluster of values( as in my earlier question) and I chose a VBA solution. While in the cou

相关标签:
1条回答
  • 2020-12-11 23:49

    It's a known issue. The VBA Round() function uses Banker's rounding while the spreadsheet cell function uses arithmetic rounding. Check the details here:

    PRB: Round Function different in VBA 6 and Excel Spreadsheet

    The workaround proposed by Microsoft is to write a custom function to get the desired results.

    Banker's rounding always rounds 0.5 to the nearest even number and is standard in accounting, which is why Excel works that way. Arithmetic rounding rounds 0.5 up to the next number.

    0 讨论(0)
提交回复
热议问题