# TRUNC Function – Truncate in Excel, VBA, & Google Sheets

This tutorial demonstrates how to use the Excel TRUNC Function in Excel to truncate a number.

## TRUNC Function Overview

The TRUNC Function Truncates a number to a specific number of digits.
To use the TRUNC Excel Worksheet Function, select a cell and type:

(Notice how the formula inputs appear)

### TRUNC Function Syntax and Inputs:

``=TRUNC(number,num_digits)``

number – A number.
num_digits – The number of decimal places you want remaining after you truncate. Zero for none. Negative will truncate to the left of the decimal place.

## TRUNC Examples in VBA

TRUNC is not a member of the application.worksheetfunction. Because of this, it cannot be used the same way from within Excel VBA. Instead, we can use the FORMAT function, which will create the same result, as follows:
Executing the following VBA statements

``````Range("B2") = Format(Range("A2"), "##,##0.0000")
Range("B3") = Format(Range("A3"), "##,##0.000")
Range("B4") = Format(Range("A4"), "##,##0.00")
Range("B5") = Format(Range("A5"), "##,##0.00")
Range("B6") = Format(Range("A6"), "##,##0")``````

will produce the following results

For the function arguments (number, etc.), you can either enter them directly into the function, or define variables to use instead.
Return to the List of all Functions in Excel

## TRUNC in Google Sheets

The TRUNC Function works exactly the same in Google Sheets as in Excel:

### Excel Practice Worksheet

Practice Excel functions and formulas with our 100% free practice worksheets!

• Automatically Graded Exercises
• Learn Excel, Inside Excel!