Formatting Issues

Combine Excel Columns with Slashes and Preserve Leading Zeros

Huda QurayshiHuda Qurayshi Nov 18, 2026 868 views

Question details

Combine project, block, and column values into a slash-separated code while preserving text and leading zeros.

Combine Excel Columns with Slashes and Preserve Leading Zeros
Product
Microsoft Excel
Device & OS
not provided
Scenario
A user wants to join code components into a result such as frv/08/023/0020.
Observed behavior
The desired result retains the original letters and leading zeros and places slashes between the required components.
Before you start

Check which cells contain each code component and whether the values with leading zeros are stored as text or as numbers with a custom number format. For new codes, set the source cells to Text before entering values that begin with zeros.

Solution 1Recommended

Join text values with TEXTJOIN

Use this method when each component is already stored as text with the required leading zeros.

1
Check the source cells

Select the cells containing the code components and check their values in the formula bar. For example, A2:D2 can contain frv, 08, 023, and 0020.

2
Enter the formula

Select an empty cell and enter =TEXTJOIN("/",TRUE,A2:D2). Adjust the range to match your source columns.

3
Fill down

Drag the formula cell's fill handle down to combine the remaining rows.

Join text values with TEXTJOIN
Empty cells are skipped: The TRUE argument ignores empty cells. TEXTJOIN does not preserve leading zeros added only by a numeric cell's display format; use TEXT for those values.
Combine codes in WPS Spreadsheets

Join code columns with slashes in WPS Spreadsheets

Use a formula in WPS Spreadsheets to combine code components and retain leading zeros stored as text, or apply TEXT to numeric components.

  1. 1. Open the workbook: Open WPS Spreadsheets and select Open to choose your Excel workbook.
  2. 2. Check the code values: Select the source cells and check whether leading zeros are part of the text. For new codes, format the cells as Text before entering them.
  3. 3. Enter a joining formula: In an empty cell, enter =A2&"/"&B2&"/"&C2&"/"&D2 for four text components. For numeric components that need fixed widths, use TEXT, such as TEXT(B2,"00").
  4. 4. Fill and save: Drag the formula cell's fill handle down, then select Save to keep the results in your workbook.
Combine project and block codes with slash separatorsUse TEXT to give numeric components the required number of digitsOpen and edit Microsoft Excel XLSX filesWork with a familiar spreadsheet interface
microsoft office alternative - wps office

Frequently Asked Questions

Why did the leading zeros disappear when I combined cells?

The zeros may come from a cell's number format rather than its stored value. Use TEXT in the formula, such as TEXT(B2,"00"), or store the code as text before entering it.

How do I combine three columns instead of four?

If the values are already text, enter =TEXTJOIN("/",TRUE,A2:C2) in an empty cell. Change the range to match your columns.

Can I add a slash between letters and numbers in one cell?

Yes. In Excel 365, a LET formula can find the first digit and insert a slash before it. The split-and-join solution above converts a first-cell value such as frv08 to frv/08 before joining the other components.

What happens if a source cell is empty?

TEXTJOIN with TRUE skips empty cells. A formula using ampersands inserts its specified slashes even when a referenced cell is empty.