Convert Integer to String in Excel Fast
In this article
Yes, you can convert an integer (whole number) to a string in Excel by forcing a text format—just select the cell, press Ctrl+1 (Windows) or Cmd+1 (Mac), choose Number, then Text. This prevents Excel’s default numeric calculations on the value.
This guide covers all methods—formulas, formatting, and VBA—for converting integers to text strings in Excel, including edge cases like leading zeros or mixed data. Whether you’re preparing data for macros, reports, or merging with other text, these steps ensure your numbers stay as plain text.
What You'll Need
- Excel for Windows or Mac (versions 2010 or later)
- A worksheet containing integer values (e.g.,
5,100, or3.14—though integers are whole numbers, non-integer cells still work) - Basic familiarity with cell references (e.g.,
A1,B2) - Optional: A macro-enabled workbook (.xlsm) if using VBA
Step-by-Step
Method 1: Format Cells as Text (Quickest)
- Select the cells containing integers (e.g.,
A1:A10) - Press Ctrl+1 (Windows) or Cmd+1 (Mac) to open the Format Cells dialog
- Click the Number tab, then select Text from the left panel
- Click OK. The numbers now appear with single quotes (e.g.,
'5) to indicate they’re treated as text
Method 2: Use the TEXT Function (Preserves Formatting)
- In an empty cell (e.g.,
C1), enter this formula to convert the integer inA1to text:=TEXT(A1, "")(The empty quotes ensure no formatting changes, just a text conversion.) - Drag the fill handle (small square at the bottom-right of the cell) down to apply the formula to other cells
- Tip: If your integer is stored as a date or time (e.g.,
41307), use=TEXT(A1, "0")to force numeric display
Method 3: Concatenate with an Empty String (Alternative Formula)
- In
C1, enter:=A1&""(The&operator concatenates the cell value with an empty string.) - Press Enter. The result is the same as the original number but treated as text
- Copy the formula down to other rows
Method 4: Use VBA (For Batch Conversion)
- Press Alt+F11 to open the VBA Editor
- In the Project Explorer, double-click ThisWorkbook or insert a new module (Insert > Module)
- Paste this code:
Sub ConvertIntegersToText()
Dim rng As Range
Set rng = Selection
rng.NumberFormat = "@"
End Sub - Close the editor and return to Excel
- Select the cells you want to convert, then run the macro by pressing Alt+F8, choosing ConvertIntegersToText, and clicking Run
Method 5: Paste as Text (For Imported Data)
- Copy the integer data (e.g., from a CSV or another worksheet)
- Paste it into your worksheet
- Right-click the pasted data, choose Paste Special, then select Text (or Values if available)
- Note: This works best when pasting from external sources like databases or text files
Common Mistakes
- Assuming all numbers are integers: Non-integers (e.g.,
3.14) will still behave like text after conversion, but calculations may break if you later treat them as numbers - Forgetting to update references: If you convert a cell to text but later reference it in a formula expecting a number, Excel may return
#VALUE! - Overusing TEXT() without quotes:
=TEXT(A1, "dd/mm/yyyy")forces a date format—omit the format string for plain text conversion - VBA errors due to unselected cells: The VBA method only works on selected ranges; selecting the entire sheet may cause errors
- Merging text and numbers incorrectly: If you concatenate text with numbers (e.g.,
=A1&"Units"), the result is still text—but leading zeros in the original number may disappear unless formatted first
Tips
- Add leading zeros: Use the TEXT function with a custom format. For example,
=TEXT(A1, "0000")turns5into0005 - Preserve formulas: If you convert a cell to text but later need to recalculate, copy the original value to a new column before converting
- Check for hidden characters: After conversion, numbers may appear with a leading apostrophe (e.g.,
'5); this is normal and indicates text status - Use Find & Replace for bulk changes: To replace all integers with text in a large sheet, select all data, apply the text format, then use Home > Find & Select > Replace to standardize values
- Export before VBA: Always save your workbook as a macro-enabled file (.xlsm) before running VBA macros
- Test with small data first: Convert a single cell or row to verify the method works before applying it en masse
Troubleshooting
If the numbers still behave like integers:
- Recheck the format: After applying text formatting, click the cell’s drop-down arrow in the status bar (bottom-left of Excel) to confirm it shows General or Text, not Number
- Clear conflicting formulas: If a cell contains a formula like
=A1+1before conversion, the result may persist. Convert the original integer cell, not the formula’s output - Update references in formulas: If you converted a cell but other formulas rely on its numeric value, update those formulas to reference the text version explicitly (e.g.,
=VALUE(C1)to force recalculation)
If VBA fails:
- Enable macros: Go to File > Options > Trust Center > Trust Center Settings > Macro Settings and ensure macros are enabled
- Check selection: The macro only works on selected cells. Deselect any non-data cells before running
- Use absolute references: If your VBA code references dynamic ranges, replace
Selectionwith a fixed range likeRange("A1:A100")
If TEXT() returns unexpected results:
- Inspect the cell’s value: Right-click the cell and choose Format Cells. If the Number tab shows General but the cell appears as a date, use
=TEXT(A1, "0")to force numeric display - Handle errors with IFERROR: Wrap the TEXT function in
=IFERROR(TEXT(A1, ""), "")to avoid#VALUE!errors if a cell is empty
If concatenation drops leading zeros:
- Format first, then concatenate: Apply text formatting to the integer cell before using
&. For example:- Format
A1as text - Enter
=A1&"-"inB1to append a hyphen
- Format
Frequently Asked Questions
Why does my text-converted number still calculate in formulas?
Excel may still treat the cell as a number if it’s part of a larger formula or array. To fix this, either:
- Update all formulas referencing the cell to use
VALUE()(e.g.,=VALUE(C1)+10), or - Copy the original integer to a new column, convert that to text, and update all formulas to use the text column instead
Can I convert a range of mixed data (numbers and text) to text?
Yes, but use VBA for safety. The ConvertIntegersToText macro in Method 4 will apply the text format to all selected cells, including those already containing text. Test on a small range first to avoid accidental overwrites.
How do I add leading zeros to a converted integer?
Use the TEXT function with a custom format. For example, to add 4 leading zeros to the number in A1:
- Enter
=TEXT(A1, "0000")inB1 - For dynamic lengths (e.g., always 5 digits), use
=TEXT(A1, "00000")and adjust the zeros as needed
Will converting to text break my VBA macros?
No, but your macros may need updates if they rely on numeric operations. For example:
- A macro that adds 1 to a cell (
Range("A1").Value = Range("A1").Value + 1) will fail ifA1is text - Use
CDbl()to convert text back to a number temporarily in the macro:Range("A1").Value = CDbl(Range("A1").Value) + 1
Can I undo a text conversion?
Yes, but you must recreate the original numeric values. Since text conversion removes the ability to perform calculations:
- Copy the text values to a new column
- Paste them back as values (right-click > Paste Special > Values)
- Reapply the original numeric format by selecting the column and pressing Ctrl+1, then choosing Number from the Format Cells dialog
Why does Excel show a apostrophe before the number (e.g., '5)?
The apostrophe indicates the cell is formatted as text but contains a numeric value. This is normal and ensures Excel doesn’t treat the value as a number for calculations. The apostrophe doesn’t appear when the cell is used in formulas.