Combine Excel Columns with Slashes and Preserve Leading Zeros
Question details
Combine project, block, and column values into a slash-separated code while preserving text and 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.
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.
Join text values with TEXTJOIN
Use this method when each component is already stored as text with the required leading zeros.
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.
Select an empty cell and enter =TEXTJOIN("/",TRUE,A2:D2). Adjust the range to match your source columns.
Drag the formula cell's fill handle down to combine the remaining rows.

Format numeric components with TEXT before joining
Use this method when the source cells contain numbers that need fixed-width leading zeros.
Split a letter-and-number project code before joining
Use this Excel 365 formula when the first component combines letters and digits, such as frv08, and the remaining components are already text.
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. Open the workbook: Open WPS Spreadsheets and select Open to choose your Excel workbook.
- 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. 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. Fill and save: Drag the formula cell's fill handle down, then select Save to keep the results in your workbook.

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.




