How to Convert Number to Text and Keep Trailing Zeros in Excel

We have an Excel worksheet that contains information about different fruits and their price. We will use this worksheet to show how to convert number to text and keep trailing zeros in Excel. The image below shows the worksheet that we are going to work with.

Convert Number to Text Keep Trailing Zeros in Excel


Method 1 – Convert Numbers to Text and Keep Trailing Zeros in Excel Using the TEXT Function

Steps:

  • Select a cell in the Price column to add decimal points to that cell value. We have selected cell C6.
  • Right-click on that cell.
  • Click on the Format Cells from the menu window.

Convert Number to Text and Keep Trailing Zeros in Excel Using the TEXT Function

  • A window titled Format Cells will appear. Set the Decimal Places to 1 to add a zero (0) after the decimal place.
  • Click on OK.

Convert Number to Text and Keep Trailing Zeros in Excel Using the TEXT Function

  • Increase the decimal places to different numbers for different values of the Price.

Convert Number to Text and Keep Trailing Zeros in Excel Using the TEXT Function

  • Use the following formula in cell D5.
=TEXT(C5,"##0.000")

 TEXT Function

Formula Breakdown:

Using the TEXT function, you can apply formatting to a number with format codes to change the way it appears.

  • The number in cell C5 has been converted to text with the trailing zeros following the decimal point.

Convert Number to Text and Keep Trailing Zeros in Excel Using the TEXT Function

  • Drag the fill handle of cell D5 to apply the formula to the rest of the cells.

drag the fill handle

  • All the numbers in the Price column have been converted to text with the trailing zeros following the decimal point.

Convert Number to Text and Keep Trailing Zeros in Excel Using the TEXT Function

  • Insert the following formula in cell E5.
=B5&" Price: "&D5

Convert Number to Text and Keep Trailing Zeros in Excel Using the TEXT Function

Formula Breakdown:

The Ampersand sign (&) will concatenate the texts in cells B5 and D5 with the textPrice between the two texts.

  • Texts in cells B5 and D5 have been concatenated using the ampersand (&) sign.

Convert Number to Text and Keep Trailing Zeros in Excel Using the TEXT Function

  • Drag the fill handle of cell E5 to apply the formula to the rest of the cells.

drag the fill handle

  • Here’s the result.

Convert Number to Text and Keep Trailing Zeros in Excel Using the TEXT Function

Read More: How to Convert Number to Text with Leading Zeros in Excel


Method 2 – Use the IF Function to Convert Numbers to Text and Keep Trailing Zeros in Excel

Steps:

  • Add decimal points to the cell values in the Price column as in Method 1.
  • Use the following formula in cell D5.
=IF(CELL("FORMAT",C5)="F3", TEXT(C5,"0.000"), TEXT(C5, 0))

Use the IF Function

Formula Breakdown:

  • IF function will check if the number has 3 decimal points.
  • If the number has 3 decimal points, the TEXT function will convert the number to text while keeping those 3 decimal points with the number.
  • If the number does not have 3 decimal points, the TEXT function will convert the number to text without changing anything.
  • The number in cell C5 has been converted to text with the trailing zeros following the decimal point.

Use the IF Function to Convert Number to Text and Keep Trailing Zeros in Excel

  • Drag the fill handle of cell D5 to apply the formula to the rest of the cells.

drag the fill handle

  • All the numbers in the Price column have been converted to text with the trailing zeros following the decimal point.

Use the IF Function

  • If we use the same concatenation formula using the ampersand (&) sign, we will see that respective texts in the Product and Number to Text columns have been concatenated.

Use the IF Function to Convert Number to Text and Keep Trailing Zeros in Excel


Method 3 – Convert Numbers to Text and Keep Trailing Zeros Using the Apostrophe Symbol

Steps:

  • Put an apostrophe sign () in front of each number in the Price column. That will convert the number to text while keeping trailing zeros.

Convert Number to Text and Keep Trailing Zeros in Excel Using the Apostrophe Symbol

Read More: How to Convert Number to Text with Commas in Excel


Method 4 – Use VBA Code to Convert Numbers to Text and Keep Trailing Zeros in Excel

Steps:

  • Select all the cells in the Price column.
  • Select Visual Basic from the Developer tab. You can also press Alt + F11.

Use a VBA Code to Convert Number to Text and Keep Trailing Zeros in Excel

  • Click on the Insert button and select Module.

Use a VBA Code to Convert Number to Text and Keep Trailing Zeros in Excel

  • Insert the following code in the window that appears.
Sub KeepTrailingZeros()
    Dim NumRange As Range
    Set NumRange = Selection
    NumRange.NumberFormat = "#,##0.000;-#,##0.000"
End Sub
  • Click on the Run ().

Use a VBA Code to Convert Number to Text and Keep Trailing Zeros in Excel

  • All the numbers in the Price column have been converted to text with the trailing zeros following the decimal point.

Use a VBA Code to Convert Number to Text and Keep Trailing Zeros in Excel

  • Use the same TEXT formula we have used in Method 1 in cell D5 to convert the number in cell C5 to text.

Use a VBA Code to Convert Number to Text and Keep Trailing Zeros in Excel

  • Upon dragging the fill handle downward to apply the formula to the rest of the cells, we will see that all the numbers in the Price column have been converted to text with the trailing zeros following the decimal point.

Use a VBA Code to Convert Number to Text and Keep Trailing Zeros in Excel


Bonus – Add Trailing Zeros Using a Formula in Excel

Steps:

  • Use the following formula in cell D5.
=C5&REPT("0",5-LEN(C5))

Add Trailing Zeros Using Formula in Excel

Formula Breakdown:

  • LEN(C5) will measure the length of the value in cell C5. The function will return 3 as the value in C5 is a 3 digits number.
  • 5-LEN(C5) will be 2.
  • The REPT function will then repeat the number zero (0) 2 times.
  • The ampersand (&) sign will then concatenate the value of cell C5 and the two zero (0) together to add two trailing zeros after the number in cell C5.
  • The number in cell C5 has two trailing zeros.

Add Trailing Zeros Using Formula in Excel

  • Drag the Fill handle of cell D5 to apply the formula to the rest of the cells.

drag the fill handle

  • The formula has added two trailing zeros to each number in the Price.

Formula in Excel


Quick Notes

  • If you do not have the Developer tab, you can make it visible via File > Option > Customize Ribbon.

Download the Practice Workbook


Related Articles


<< Go Back to Excel Convert Number to Text | Learn Excel

Get FREE Advanced Excel Exercises with Solutions!
ASM Arman
ASM Arman

Abu Saleh Arman is a Marine engineer and Excel & VBA expert. He loves programming with VBA. He finds VBA programming a time-saving tool to manipulate data, handle files, and interact with the internet. He is very interested in Python, MATLAB, PHP, Deep Neural Networks, and Machine Learning, showcasing his diverse skill set. Arman holds a B.Sc in Naval Architecture & Marine Engineering from BUET, Bangladesh. However, he switched to a content developer, where he writes technical content... Read Full Bio

We will be happy to hear your thoughts

Leave a reply

Advanced Excel Exercises with Solutions PDF

 

 

ExcelDemy
Logo