Calc RPAD function

The RPAD function pads a string with a specified character to the right until it reaches a specified length.

Help CentreFunctions & Formulas

For a full list of available calculation functions, please read What calculation functions are supported.


Description

The RPAD function pads a string with a specified character to the right until it reaches a specified length. This is useful for formatting strings to a consistent length, such as in reports or data exports.


Syntax

RPAD(string, length, pad_string)


The RPAD function syntax has the following arguments:

  • string: Required. The original string that you want to pad.
  • length: Required. The total length of the resulting string after padding.
  • pad_string: Required. The string to use for padding. If this string is longer than the remaining space, it will be truncated.

Example

FormulaDescriptionResult
=RPAD("abc", 5, "-")Pads "abc" with dashes to make it 5 characters long.abc--
=RPAD("123", 6, "0")Pads "123" with zeros to make it 6 characters long.123000

Errors

For a full list of formula errors, please read Formula errors.


Related functions

See it working on your own data

Everything documented here ships with the platform – try the document tools free, or go live in 7 days.