# Excel-VBA: Math Functions – ROUND()

`Description: `

The ROUND func­tion in MS excel returns a rounded num­ber based on the spec­i­fied num­ber of digits.

Note : ROUND() works slightly diffrent when used as Excel for­mula, Click here to know about it For­mula–ROUND()

`Format:`

As VBA Func­tion : ROUND(number, [dec­i­mal places])

Note : If you don’t pro­vide the dec­i­mal places the func­tion will con­sider it as 0 and returns the Integer.

`Arguments:`

• Num­ber
• Manda­tory
• Type: Num­ber
• Num­ber which requires to be rounded.
• dec­i­mal places
• Optional
• Type: Num­ber
• Num­ber of dig­its to the num­ber to

Impor­tant Notes:

If num­ber you are round­ing ends with 5 then this func­tion will return the num­ber end­ing with near­est even num­ber, see example

```Round(4.55,1)
Output: 4.6   (round up)

Round(6.85,1)
Output: 6.8 (round down)
```

Other Exam­ples:

```Round(3.33,0)
Output: 3

Round(25.77,1)
Output: 25.8

Round(37.14,1)
Output: 37.1

Round(26.32)
Output: 26
```

Code:

```Function getROUND()

Dim val1

Dim val2

Dim val3

Dim val4

val1 = 3.33

val2 = 8.85

val3 = 9.99

val4 = 25.787676

strResult = "The ROUND number of " & val1 & " when no argument for decimal provided " & Round(val1) & vbCrLf

strResult = strResult & "The ROUND number of " & val2 & " with 1 decimal place is " & Round(val2, 1) & vbCrLf

strResult = strResult & "The ROUND number of " & val3 & " with 0 decimal place is " & Round(val3, 0) & vbCrLf

strResult = strResult & "The ROUND number of " & val4 & " with 2 decimal place is " & Round(val4, 2)

MsgBox strResult

End Function
```

Out­put:

ROUND() — Function