PADVALUES

PADVALUES ( values, times, with value )

PADVALUES returns selected values with padding or additional values. The amount of padding is specified in the times parameter. The values are returned as blanks unless otherwise specified in the with value parameter. For instance, if you wanted to pad the values (1,2,3) three times with the value "4", PADVALUES would return the following: 1,2,3,4,4,4.

The examples in this section use this data set:

  A B
1 Country Votes
2 Canada 30
3 USA 22
4 Australia 7
5 France 4
6 Italy 32
7  Brazil  
8 Germany  

Using PADVALUES

This example uses PADVALUES to pad column B with two values to match the amount of values in column A.

PADVALUES(SLICE(values), times, "string")

  • values: set to the Votes data in column B (B:B).
  • times: set to the number, 2.
  • withvalue: set to the string, "No votes".

Note: SLICE is used to remove the column header. 

Result: 30, 22, 7, 4, 32, 0, 0, No votes, No votes.

PADVALUES and COUNTALL

This example uses COUNTALL to find the difference of values between column A and B. That number is used to define times in PADVALUES. 

PADVALUES(SLICE(values1), COUNTALL(values2)-COUNTALL(values1), 0 )

  • values1: set to the Votes data in column B (B:B).
  • values2: set to the Country data in column A (A:A).

Result: 30, 22, 7, 4, 32, 0, 0.

Column B is returned with the padding of two more values to match the amount of values in column A. 

Learn more:

Now that you know more about PADVALUE, check out the following tutorial:

Related links: