Results 1 to 2 of 2
  1. #1
    Join Date
    Jan 2006

    Question Unanswered: Need formula for adding zero to number?

    I have a field that can have 8 numbers or 9 numbers. If the field only has 8 numbers I want to add a leading zero to display on the report. Any formula out there to this?

  2. #2
    Join Date
    Dec 2004
    I wish the search function in this forum worked, because I know I've seen and posted this before.

    In some newer versions of CR there's a FORMAT function. So you create a field and define it as FORMAT(FIELDA,"000000000") where FIELDA is the field you need to pad. The number of zeros in the FORMAT function is the number of characters you need, so use nine zeros to pad the number to nine characters.

    If that's not available, I use this quick and dirty way to pad any number with leading zeros. I concatenate a bunch of zeros to the front end of a string field and then trim the results to the correct number of characters. Like so:


    If your field is numeric, you'll need to convert it to a string first:


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts