Math and trigonometry functions

ROUNDUP

Known larger differences on 563 of 52,985 recorded answers

Of 52,985 recorded answers (52,841 in the answer bank and 144 workbook cells), 563 do not match: 236 differ by more than 16 ULP, 327 differ by at most 16 ULP. How we measure this · See the Rust code

Local names in 40 languages
LanguageName in Excel
ArabicROUNDUP
BulgarianROUNDUP
CzechROUNDUP
DanishRUND.OP
GermanROUNDUP
GreekROUNDUP
English (Australia)ROUNDUP
English (United Kingdom)ROUNDUP
English (United States)ROUNDUP
SpanishREDONDEAR.MAS
EstonianROUNDUP
FinnishPYÖRISTÄ.DES.YLÖS
FrenchARRONDI.SUP
HebrewROUNDUP
CroatianROUNDUP
HungarianKEREK.FEL
IndonesianROUNDUP
ItalianROUNDUP
JapaneseROUNDUP
KoreanROUNDUP
LithuanianROUNDUP
LatvianROUNDUP
NorwegianAVRUND.OPP
DutchAFRONDEN.NAAR.BOVEN
PolishZAOKR.GÓRA
Portuguese (Brazil)ROUNDUP
Portuguese (Portugal)ARRED.PARA.CIMA
RomanianROUNDUP
RussianОКРУГЛВВЕРХ
SlovakROUNDUP
SlovenianROUNDUP
Serbian (Latin)ROUNDUP
SwedishAVRUNDA.UPPÅT
ThaiROUNDUP
TurkishYUKARIYUVARLA işlevi
UkrainianROUNDUP
VietnameseROUNDUP
Chinese (Simplified)ROUNDUP
Chinese (Hong Kong)ROUNDUP
Chinese (Traditional)ROUNDUP

Names from Microsoft's support site.

What it does

ROUNDUP(number, num_digits)

ROUNDUP(number, num_digits) rounds away from zero when a nonzero part is discarded. Positive digit counts address places after the decimal point, zero the integer position, and negative counts places to its left.

Try it

Input cells (optional)

Example: {"B2": 3, "B3": 4}. A1 holds the formula. Other cells need values before a formula can read them.

Enter a formula, then calculate.

Runs locally in your browser with OneCalc. Its answer may differ from Excel. Use English function names and commas between arguments.

=ROUNDUP(-7.21,1) returns -7.3; =ROUNDUP(721,-1) returns 730. “Up” means a larger magnitude, so a negative result becomes more negative.

Quirks

The recorded functions first read fifteen significant decimal digits. Asking to retain more digits can therefore change an input that mathematically needs no rounding. The recorded ROUNDDOWN(283025097725723.5,0) returns 283025097725724, showing that the preliminary reading can move the number upward before truncation. Huge digit counts have recorded integer-conversion behaviour rather than a simple “keep everything” rule. Near the normal-range boundary and overflow, worksheet publication needs separate handling.

The exact-cell minimum normal input 0x0010000000000000 has a recorded early return of 0x000ffffffffffffa, even at zero requested digits. That return happens before ordinary digit rounding. At the upper end, ROUNDUP returns #NUM! for the overflowing decimal result. See the packing rules and worked encodings.

The rounding functions read 15 digits first, so ROUNDDOWN can round up

Before choosing a digit these functions read the number to 15 significant digits on the x87 unit: with e the decimal exponent and n = 14 - e, y = RN64(|x| * 10^n), or RN64(|x| / 10^-n) when n is negative, while 10^|n| is exact in 64 bits (|n| <= 27). A half in y goes up for ROUNDDOWN, ROUNDUP and TRUNC and down for ROUND. So digits beyond the 15th are lost even when the requested precision keeps them: ROUND(-1594628480062905,14) loses its last digit, and ROUNDDOWN(283025097725723.5,0) returns 283025097725724, larger than its input.

FormulaExcelMathematical value
ROUND(-1594628480062905, 14)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

number: -1594628480062905
0xc316a939806956e4

num_digits: 14
0x402c000000000000

An integer rounded to 14 places is itself.

-1594628480062900
0xc316a939806956d0
-1594628480062905
0xc316a939806956e4
ROUNDDOWN(283025097725723.5, 0)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

number: 283025097725723.5
0x42f0168ea69971b8

num_digits: 0
0x0000000000000000

ROUNDDOWN drops the fraction .5.

283025097725724
0x42f0168ea69971c0
283025097725723
0x42f0168ea69971b0

Inputs, build details and evidence

Near DBL_MAX, ROUND returns NaN bit patterns that Excel treats as numbers

ROUND of a number near 1.8E308 can return a binary64 with an all-ones exponent field. A decimal result of 2^1024 or more keeps its 53-bit significand, and its exponent is carried into the exponent field without a check, so the bits are a NaN. ROUND, ROUNDDOWN and TRUNC return those bits; ROUNDUP gives #NUM!. The recorded rows hold 430 such ROUND rows, 102 ROUNDDOWN and 95 TRUNC, and all 627 follow this. Even ROUND(DBL_MAX,0), whose answer is DBL_MAX, returns 0x7ff000000000000a. The cell shows 2E+308 or 1.8E+308, and a pattern with its sign bit set shows 2E+308 too, with no minus. ISNUMBER gives TRUE, ISERROR FALSE, TYPE 1, ERROR.TYPE #N/A; A1=A1 and A1>0 are TRUE. =A1, N(A1), MAX(A1), ABS(A1) and IFERROR(A1,...) pass the pattern on, as does =-A1 with its sign unchanged. Arithmetic on it (A1+0, A1*1, A1-A1, SUM, ROUND) gives #NUM!, and TEXT(A1,"0") gives #VALUE!. Saved to .xlsx, each such cell is written as the error #NUM!; reopened, the cells read #NUM! until a full recalculation brings the patterns back.

Explanation (inferred): That one decimal-to-binary conversion routine is the source of all these patterns is inferred from the exponent-overflow encoding.

FormulaExcelMathematical value
ROUND(1.7976931348623157E+308, 0)
Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading
Inputs and reference value

Number supplied through a cell.

number: 1.7976931348623157e+308
0x7fefffffffffffff

num_digits: 0
0x0000000000000000

DBL_MAX is an integer, so rounding it to 0 places returns it.

NaN bit pattern, shown as 1.8E+308
0x7ff000000000000a
1.7976931348623157e+308
0x7fefffffffffffff
ROUND(1.7976931348623157E+308, -307)
Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading
Inputs and reference value

Number supplied through a cell.

number: 1.7976931348623157e+308
0x7fefffffffffffff

num_digits: -307
0xc073300000000000

The rounded value exceeds the largest binary64; Excel reports overflow in its own arithmetic as #NUM!.

NaN bit pattern, shown as 1.8E+308
0x7ff005419221015d
#NUM!
ROUND(1.7976931348623157E+308, -308)
Excel 16.0 build 20527, Windows; bitness and CPU not recorded in this reading
Inputs and reference value

Number supplied through a cell.

number: 1.7976931348623157e+308
0x7fefffffffffffff

num_digits: -308
0xc073400000000000

The rounded value exceeds the largest binary64; Excel reports overflow in its own arithmetic as #NUM!.

NaN bit pattern, shown as 2E+308
0x7ff1ccf385ebc8a0
#NUM!

Inputs, build details and evidence

ROUNDUP, ROUNDDOWN and TRUNC read num_digits from its low 16 bits

ROUNDUP, ROUNDDOWN and TRUNC take the digit count from the low 16 bits of the integer part of |num_digits|, with the sign of num_digits. If |num_digits| is 2^32 or more, or those low bits are 32768 or more, the truncation happens at 100 places (10^-100, or 10^100 for a negative count). So 65536 acts as 0, 65537 as 1, 32768 to 65535 as 100, and -2147483748, whose low 16 bits are 100, as -100. In the out-of-range case ROUNDUP adds no unit for a positive count, and gives #NUM! for a negative count when a digit is dropped.

FormulaExcelMathematical value
ROUNDUP(1.234567890123456e-200, 65536)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: 1.234567890123456e-200
0x166e3d71f622be8f

num_digits: 65536
0x40f0000000000000

The exact decimal expansion of this binary64 number has fewer than 32768 places, so a truncation at num_digits places returns the number itself.

1
0x3ff0000000000000
1.234567890123456e-200
0x166e3d71f622be8f
ROUNDUP(1.234567890123456e-200, 65537)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: 1.234567890123456e-200
0x166e3d71f622be8f

num_digits: 65537
0x40f0001000000000

The exact decimal expansion of this binary64 number has fewer than 32768 places, so a truncation at num_digits places returns the number itself.

0.1
0x3fb999999999999a
1.234567890123456e-200
0x166e3d71f622be8f
ROUNDUP(1.234567890123456e-200, 32768)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: 1.234567890123456e-200
0x166e3d71f622be8f

num_digits: 32768
0x40e0000000000000

The exact decimal expansion of this binary64 number has fewer than 32768 places, so a truncation at num_digits places returns the number itself.

0
0x0000000000000000
1.234567890123456e-200
0x166e3d71f622be8f
TRUNC(1.234567890123456e-200, 65536)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: 1.234567890123456e-200
0x166e3d71f622be8f

num_digits: 65536
0x40f0000000000000

The exact decimal expansion of this binary64 number has fewer than 32768 places, so a truncation at num_digits places returns the number itself.

0
0x0000000000000000
1.234567890123456e-200
0x166e3d71f622be8f

Inputs, build details and evidence

ROUNDUP adds its unit in binary64, one bit from the decimal answer

ROUNDUP forms the ROUNDDOWN result, converts it to binary64, converts one unit 10^-p to binary64, and adds the two on the x87 unit, storing the sum to binary64. The sum need not be the binary64 value nearest the decimal answer, so ROUNDUP(-1.125,2) is -1.1300000000000001 and ROUNDUP(3.535,2) is 3.5399999999999996. The difference shows when the result is compared with a typed 3.54.

FormulaExcelMathematical value
ROUNDUP(-1.125, 2)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

number: -1.125
0xbff2000000000000

num_digits: 2
0x4000000000000000

The decimal answer has a nearest binary64 value; rounding away from zero at 2 places gives that value.

-1.1300000000000001
0xbff2147ae147ae15
-1.13
0xbff2147ae147ae14
ROUNDUP(3.535, 2)
Excel 16.0 build 20430, Windows 64-bit, AMD Ryzen 7 4800H
Inputs and reference value

Number supplied through a cell.

number: 3.535
0x400c47ae147ae148

num_digits: 2
0x4000000000000000

The decimal answer has a nearest binary64 value; rounding away from zero at 2 places gives that value.

3.5399999999999996
0x400c51eb851eb851
3.54
0x400c51eb851eb852

Inputs, build details and evidence

At tiny magnitudes ROUNDUP may add no unit, and the two signs differ

ROUNDUP adds no unit when the unit itself is below the normal range, whichever the sign. For a positive number it also adds none when the 15-digit reading, as binary64, lies less than 2^-1026 above the truncation; negative numbers have no such distance. So ROUNDUP(1.0001086461844975E-307,307) is 1E-307 and ROUNDUP(-1.0001086461844975E-307,307) is -2E-307, with the same digits dropped. At -1.2225E-307 and 308 places the unit, 1E-308, is subnormal, and the answer stays at -1.2E-307.

FormulaExcelMathematical value
ROUNDUP(1.0001086461844975e-307, 307)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: 1.0001086461844975e-307
0x0031fa982c40c60e

num_digits: 307
0x4073300000000000

The number has a nonzero digit past 307 places, so rounding away from zero at 307 places gives 2E-307; nearest binary64.

1e-307
0x0031fa182c40c60d
2e-307
0x0041fa182c40c60d
ROUNDUP(-1.2225073858507202e-307, 308)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: -1.2225073858507202e-307
0x8035fa182c40c60e

num_digits: 308
0x4073400000000000

The number has a nonzero digit past 308 places, so rounding away from zero at 308 places gives -1.3E-307; nearest binary64.

-1.2e-307
0x80359283684dba77
-1.3e-307
0x80375eb9065434ab
ROUNDUP(1.0000000022250739e-300, 307)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: 1.0000000022250739e-300
0x01a56e1fc3c5c026

num_digits: 307
0x4073300000000000

1.0000001000000001e-300
0x01a56e1fe6ed23b2
—

Inputs, build details and evidence

TRUNC of DBL_MIN returns a subnormal, not 0

With DBL_MIN (0x0010000000000000) as number, TRUNC, ROUNDDOWN and ROUNDUP return the subnormal 0x000ffffffffffffa at each num_digits recorded, so TRUNC(DBL_MIN,0) is not 0. That value is 6 steps below DBL_MIN and 3 steps below 0x000ffffffffffffd, the binary64 nearest the 15-digit reading 2.22507385850720E-308. The recorded rows hold 256 such cases for each of the three functions. ROUND gives 0 on the same inputs.

FormulaExcelMathematical value
TRUNC(2.2250738585072014e-308, 0)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: 2.2250738585072014e-308
0x0010000000000000

num_digits: 0
0x0000000000000000

DBL_MIN is below 1, so truncating it at 0 or 1 places gives 0.

2.2250738585071984e-308
0x000ffffffffffffa
0
0x0000000000000000
TRUNC(2.2250738585072014e-308, 1)
Excel 16.0 build 20430, Windows 64-bit, CPU not recorded in this capture
Inputs and reference value

Number supplied through a cell.

number: 2.2250738585072014e-308
0x0010000000000000

num_digits: 1
0x3ff0000000000000

DBL_MIN is below 1, so truncating it at 0 or 1 places gives 0.

2.2250738585071984e-308
0x000ffffffffffffa
0
0x0000000000000000

Inputs, build details and evidence

How to implement

The current worksheet wrapper reads numeric arguments in order and flushes subnormal numeric operands to zero. Return zero for a zero number before finding its decimal exponent. The following steps start with a finite, nonzero admitted input. The stored-arithmetic chapter explains exact binary decoding and significand rounding.

First construct the number’s fifteen-significant-digit reading. Extract the exact binary64 value and find its decimal exponent e by comparisons with exact powers of ten, so 10^e <= abs(x) < 10^(e+1). Put s=14-e. When abs(s)<=27, evaluate abs(x)*10^s (or abs(x)/10^(-s)) with a 64-bit significand and extended exponent range, rounding to nearest/even. Do not store that scaled value to binary64 before the integer decision. Round it to an integer: exact halves go down for ROUND’s reading, up for the directed functions’ readings. Retain the sign and the exact decimal value integer*10^(-s).

This reading step is a measured reconstruction with a known counterexample even inside the stated scale range. For abs(s)>27, Excel’s scaling is still open; the current code falls back to exact binary64-to-decimal rounding to fifteen digits. That fallback is a candidate, not an identified Excel stage.

  1. Truncate the magnitude of num_digits and retain its low sixteen bits, then restore the sign. Magnitudes at least 2^32, or low bits at least 32768, select an out-of-range sentinel of 100 places with the original sign.
  2. Before digit rounding, check the special initial-reading return described below. If it applies, return its packed result immediately. Otherwise truncate the exact decimal reading at unit 10^(-D), then convert that truncation to nearest binary64.
  3. If a nonzero digit was discarded, convert one unit separately to binary64, add it to the truncated magnitude with the stored 64-bit-significand operation from the variance recipe, and restore the sign. Do not convert the already-incremented decimal in one step: that has a different rounding history.
  4. Suppress the added unit if it is subnormal. For positive inputs also suppress it when the stored reading minus the stored truncation is below 2^-1026. Negative inputs do not use that distance test. Out-of-range positive counts add no unit; negative ones give #NUM! when a unit would be required.

Worked: ROUNDUP(-1.125,2) truncates its exact reading to -1.12. The separately converted 1.12 and 0.01 add to the recorded 1.1300000000000001, whose sign is then restored. The final value is -1.1300000000000001, rather than the nearest binary64 conversion of the decimal -1.13.

The current boundary reconstruction handles a normal input below twice the minimum normal value whose initial reading becomes subnormal: convert twice the reading (a normal number) and decrement its encoded exponent field by one, retaining the sign and significand. This reproduces the observed packing rather than an ordinary subnormal conversion. Other final subnormals still flush. The large-scale reading and remaining last-bit discrepancies stay open; consult the dated failure breakdown.

Rust code

Show the CalcFunc source of this function

Quoted from the public repository DnaCalc/DnaCalc, crates calc-func and calc-fml, at commit 9e1884369a67. Comments are the source's own. A kernel shared with other functions appears once, on its module page.

ROUNDUP · 1 lines · calc-func/src/catalogue/rounding.rs on GitHub
call(ROUNDUP, "ROUNDUP", 2, DIGITS, roundup)
roundup · 9 lines · calc-func/src/catalogue/rounding.rs on GitHub
/// ROUNDUP: as ROUND, away from zero whenever a dropped digit is not zero.
fn roundup(
    arguments: &[CalcValue],
    services: &mut EvalServices<'_>,
) -> Result<CalcValue, FunctionFault> {
    numeric(ROUNDUP, arguments, services, |site, n| {
        directed(site, n[0], n[1], Direction::AwayFromZero)
    })
}

Kernels shared with other functions

Argument and result plumbing

No implementation has been published with a Handbook test suite for this function.

Version differences

The recorded environments below distinguish a reading from a same-input comparison. Counts describe captured inputs in each environment; overlapping captures and comparisons are not totals of unique worksheet calls.

Excel 16.0 buildPlatform and CPUCaptured inputs
19929Windows, bitness not recorded, CPU not recorded155
20430Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics3,454
20430Windows, 64-bit, CPU not recorded49,387
  • XC-ROUNDUP-001: build 19929 versus build 20430; 1 same-input pairs, 0 differing answers. Compared axes: excel-build. Numeric answers were compared by their recorded binary64 bits; other answers by typed value.

Agreement on these compared inputs does not establish agreement on unmeasured inputs.

Recorded environments and comparison details.

Retained controls from the indexed captures:

Build and recorded CPUCaptured call or argumentsExcel result
19929, CPU not recorded=ROUNDUP(-1.08328420449386575,0)-2.0 (0xc000000000000000)
20430, AMD Ryzen 7 4800H with Radeon GraphicsROUNDUP(2.5,0)3 (0x4008000000000000)
20430, CPU not recordedROUNDUP(817094511.6142203,6)817094511.61422 (0x41c859efb7ce9ec3)

These are earlier recorded answers, not new Excel runs or an additional cross-build comparison. The function JSON retains each source locator, exact argument bits where available, and input-route status. Call notation does not imply that captured binary64 values were entered as decimal formula literals.

Excel 16.0 build 20430

Windows 64-bit, CPU not recorded in this capture

ROUNDUP(1.234567890123456e-200, 65536) returned 1 (0x3ff0000000000000). ROUNDUP(1.234567890123456e-200, 65537) returned 0.1 (0x3fb999999999999a). 4 further recorded controls are attached. Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • ROUNDUP(1.234567890123456e-200, 65536) → 1
    0x3ff0000000000000 (cell-value2)
  • ROUNDUP(1.234567890123456e-200, 65537) → 0.1
    0x3fb999999999999a (cell-value2)
  • ROUNDUP(1.234567890123456e-200, 32768) → 0
    0x0000000000000000 (cell-value2)
  • ROUNDUP(1.0001086461844975e-307, 307) → 1e-307
    0x0031fa182c40c60d (cell-value2)
  • ROUNDUP(-1.2225073858507202e-307, 308) → -1.2e-307
    0x80359283684dba77 (cell-value2)
  • ROUNDUP(1.0000000022250739e-300, 307) → 1.0000001000000001e-300
    0x01a56e1fe6ed23b2 (cell-value2)

Excel 16.0 build 20430

Windows 64-bit, AMD Ryzen 7 4800H

ROUNDUP(-1.125, 2) returned -1.1300000000000001 (0xbff2147ae147ae15). ROUNDUP(3.535, 2) returned 3.5399999999999996 (0x400c51eb851eb851). Inputs were supplied through cells using Value2. These are controls from this environment, not a same-input comparison with another build.

Observed formulas and results
  • ROUNDUP(-1.125, 2) → -1.1300000000000001
    0xbff2147ae147ae15 (cell-value2)
  • ROUNDUP(3.535, 2) → 3.5399999999999996
    0x400c51eb851eb851 (cell-value2)

Excel 16.0 build 19929

Windows, bitness not recorded, CPU not recorded

155 captured inputs are indexed for this environment. Capture dates are not recorded. This is a reading count, not a comparison with another build. Retained control =ROUNDUP(-1.08328420449386575,0) returned -2.0 (0xc000000000000000). The selected archive row does not record its input plumbing; no input route is inferred.

Observed formulas and results
  • =ROUNDUP(-1.08328420449386575,0) → -2.0
    0xc000000000000000 (not-recorded)

Excel 16.0 build 20430

Windows, 64-bit, AMD Ryzen 7 4800H with Radeon Graphics

3,454 captured inputs are indexed for this environment. Capture dates: 2026-09-25 to 2026-09-25. This is a reading count, not a comparison with another build. Retained control ROUNDUP(2.5,0) returned 3 (0x4008000000000000). The selected archive row does not record its input plumbing; no input route is inferred.

Observed formulas and results
  • ROUNDUP(2.5,0) → 3
    0x4008000000000000 (not-recorded)

Excel 16.0 build 20430

Windows, 64-bit, CPU not recorded

49,387 captured inputs are indexed for this environment. Capture dates: 2026-09-29 to 2026-09-29. This is a reading count, not a comparison with another build. Retained control ROUNDUP(817094511.6142203,6) returned 817094511.61422 (0x41c859efb7ce9ec3). The capture specifies exact-double bulk Value2 cell input.

Observed formulas and results
  • ROUNDUP(817094511.6142203,6) → 817094511.61422
    0x41c859efb7ce9ec3 (cell-value2)

Alternatives

ROUND chooses a nearest decimal; MROUND chooses a multiple. INT floors negatives; TRUNC removes their fraction toward zero.

Named variants

No named variants are recorded yet.

Suggest a correction or contribute an implementation · For agents