top of page

35. Round to the Nearest Thousand

Description

Rounds a number variable to the nearest thousand, hundred, etc.

Code

ROUND( ( NumberVar / 1000 ) ), 0 ) * 1000

Explanation

This computation shows how to round large numbers, such as rounding to the nearest thousand. To always round to the next number instead, see Computation 35 - Round to the Next Thousand.

The example assumes that you are rounding to the nearest 1000. To round to the nearest 10, 100, 10,000, etc., simply adjust the values in the computation.

This script works by dividing your number by 1000, rounding the answer to the nearest 1 (no decimals), and multiplying the result by 1000. For example: 2001 / 1000 = 2.001; 2.001 rounded to the nearest 1 = 2; 2 * 1000 = 2000. But, 2500 / 1000 = 2.5; 2.5 rounded to the nearest 1 = 3; 3 * 1000 = 3000.

©2023 by My Site. Proudly created with Wix.com

  • Facebook
  • Twitter
  • LinkedIn
bottom of page