关于算法:四舍五入到最接近的整数

Round up to the nearest whole even number

我认为这是一个简单的数学问题,我正在寻找一种算法来舍入到最接近的整数,所以

1
2
3
4
4.4 = 6
5.1 = 6
2.1 = 4
1.9 = 2 etc....

如果您能给我很棒的VBA语法。
我知道Excel是=even(..)函数,但无法在VBA中工作。

谢谢


您可以简单地通过以下方式使用Excel函数:

1
Application.WorksheetFunction.Even(YourNumber)