Purpose

Return value

Syntax

=BASE(number,radix,[min_length])
  • number - The number to convert to a given base.
  • radix - The base to convert to.
  • min_length - [optional] The minimum string length to return, achieved by padding with zeros.

Using the BASE function

The BASE function converts a number to a given base and returns the result as a text string . Base is specified with the radix argument.

The BASE function takes three arguments : number , radix , and min_length . Number should be an integer between 1 and 2^53. If number is negative, BASE returns a #NUM! error. The radix argument is used to specify base. Radix represents the number of digits used to represent numbers and should be an integer between 2 and 36. The optional min_length argument is the minimum string length that BASE should return. When min_length is provided, BASE will pad the output with zeros as needed to achieve the length specified.

Examples

The radix argument specifies base and the output from the BASE function is a text string . For example, the formulas below convert the number 13 into text representations of 13 in base 2 (binary), base 10 (decimal), and base 16 (hexadecimal):

=BASE(13,2) // returns "1101"
=BASE(13,10) // returns "13"
=BASE(13,16) // returns "D"

In the worksheet shown, the input numbers are being converted to three different representations: base 2 (binary), base 10 (decimal), and base 16 (hexadecimal). The formulas in D5, E5, and F5 are:

=BASE(B5,2) // base 2
=BASE(B5,10) // base 10
=BASE(B5,16) // base 16

The function also offers an optional argument min_length which will pad the returned string with zeros when its length is less than the given value. For example, the formulas below require a minimum length of 4:

=BASE(3,2,4) // returns "0011" as text
=BASE(10,16,4) // returns "000A" as text

DECIMAL function

The DECIMAL function performs the opposite conversion as the BASE function:

=BASE(100,2) // returns "1100100"
=DECIMAL("1100100",2) // returns 100

See more on the DECIMAL function here .

Notes

  • The result from BASE is a text string.
  • If number is negative, BASE returns a #NUM! error.
  • BASE expects integers; decimal values are ignored.

Purpose

Return value

Syntax

=CEILING(number,significance)
  • number - The number that should be rounded.
  • significance - The multiple to use when rounding.

Using the CEILING function

The Excel CEILING function rounds a number up to a given multiple. The multiple to use for rounding is provided as the significance argument. If the number is already an exact multiple, no rounding occurs and the original number is returned.

The CEILING function takes two arguments , number, and significance . Number is the numeric value to round up. The significance argument is the multiple to which number should be rounded. In most cases, significance is provided as a numeric value, but CEILING can also understand time entered as text like “0:15”. See the example below.

CEILING works like the MROUND function , which also rounds to a given multiple. However, unlike MROUND, which rounds to the nearest multiple, the CEILING function rounds up to the next multiple.

Note: the CEILING function is officially listed as a compatibility function , replaced by CEILING.MATH and CEILING.PRECISE .

Examples

The formulas below show how CEILING rounds up values to a given multiple:

=CEILING(10,3) // returns 12
=CEILING(36,7) // returns 42
=CEILING(309,25) // returns 325
=CEILING(610,100) // returns 700
=CEILING(-5.4,1) // returns -5

To round a number in A1 up to the nearest multiple of 5, you can use a formula like this:

=CEILING(A1,5)

Round pricing up to end with .99

CEILING can be useful to set pricing after currency conversion or discounts are applied. For example, the formula below will round a value in A1 up to the next whole dollar, then subtract 1 cent, to return a price like $2.99, $5.99, $49.99, etc.

=CEILING(A1,1) - 0.01

Round time up to nearest 15 minutes

CEILING understands time formats and can be used to round time up to a given multiple. For example, to round a time in A1 up to the nearest 15 minutes, you can use CEILING like this:

=CEILING(A1,"0:15") // round up to nearest 15 min

Other rounding functions

Excel provides a number of functions for rounding:

  • To round normally, use the ROUND function .
  • To round to the nearest multiple, use the MROUND function .
  • To round down to the nearest specified place , use the ROUNDDOWN function .
  • To round down to the nearest specified multiple , use the FLOOR function .
  • To round up to the nearest specified place , use the ROUNDUP function .
  • To round up to the nearest specified multiple , use the CEILING function .
  • To round down and return an integer only, use the INT function .
  • To truncate decimal places, use the TRUNC function .

Notes

  • CEILING works like the MROUND function , but CEILING always rounds up.
  • If number is an exact multiple of significance, no rounding occurs.
  • If number and significance are both negative, CEILING rounds down, away from zero .
  • If number is negative, and significance is positive, CEILING rounds up, towards zero .
  • For more control over how CEILING rounds negative numbers, see the CEILING.MATH function .