avf9pw
New Contributor

Return a value with a specific number of characters.

Is there a way we can format a to return a value with a set number of characters?

For example, if I have a formula that returns the value 4, is there a way I can format the cell to return the number 0004?

2 REPLIES2
rob_marshall
Moderator

@avf9pw

First, Text is bad, but sometimes you have to have it. So to answer your question, yes: right("00000"&text(line item with the number),4)

Rob

kevin.cho
Certified Master Anaplanner

An alternative approach is below - here, we determine how many leading 0s we need to add, by comparing the number of digits in the original value, and comparing it against our "expected" format.

Special note in Example 5, when the number of digits in value exceeds our expected length of the string (max 4 leading 0s). If this is not acceptable, then you will need to do further checks on the Value itself.

Example Leading 0s.png2022-04-30 14_34_47-Anaplan - POC and 2 more pages - Default Profile - Microsoft​ Edge.png