How to Convert Single-Digit Numbers to Two-Digit Format on Make.com

Have you ever found yourself in a situation where you needed to convert single-digit numbers into a two-digit format? For instance, turning 2 into 02, or 7 into 07, while leaving double-digit numbers as they are? This is a common scenario when dealing with timestamps or other data types where uniformity is key. But how do you go about it? Let's dive in and find out.

The Problem

Imagine you have a list of numbers, some of which are single digits, and others are double or triple digits. You want to convert all single-digit numbers into a two-digit format by adding a '0' in front. However, you want to leave all double-digit numbers as they are. Here's an example:

  • 2 → 02
  • 7 → 07
  • 14 → 14
  • 125 → 125
  • 6346 → 6346
  • 9 → 09

The Solution

The solution to this problem is simpler than you might think. You can use an 'if' function to achieve this. Here's how:

You can use if function for this. Something like this,

Screenshot from 2023-07-28 01-12-02

Troubleshooting Tips

If you're having trouble implementing this solution, here are a few tips:

  • Make sure you're using the correct syntax for the 'if' function.
  • Ensure that the numbers you're working with are indeed numbers and not strings. If they are strings, you'll need to convert them to numbers first.
  • Test your function with a variety of numbers to make sure it's working as expected.

Conclusion

And there you have it! With a simple 'if' function, you can easily convert single-digit numbers into a two-digit format, while leaving double-digit numbers as they are. This can be particularly useful when working with timestamps or other data types where uniformity is key. Happy coding!

You do have further questions?

Ask your question via E-Mail: Richard@make-app.de
Book a paid Support & Consulting Session
New Make.com user? Sign up through this Affiliate Link to receive 10.000 operations for FREE.