Stop wrestling with text in Excel: these 8 tools are game-changers

Configurare noua (How To)

Situatie

Solutie

Converting “fake” text to numbers

By default, Excel aligns numbers to the right and text to the left. If your numbers are hugging the left side of the cell, or you see a green triangle, Excel thinks they’re words, so any arithmetic you perform won’t work as expected.

An Excel table with items in column A and weights in column B, with the numbers in the Weight column stored as text.

To fix this manually, select the cells, click the exclamation icon, and choose “Convert to Number”

A column in an Excel table is highlighted, and Convert to Number is selected in the error menu.

However, if you imported this data and are likely to add more later, the best fix is the double-unary operator (–). In an extra column, type the equal sign (=), add two minus signs (), and click the first cell containing the “fake numbers.” In my case, I’m applying the fix to the Weight column.

A 'Converted' column in an Excel table, with the equal sign and two dashes typed, and the cell to be converted selected.

If you’re using an Excel table, when you press Enter, the formula automatically fills down and—most importantly—instantly converts new data you paste into the table.

A column with numbers stored as text in Excel is converted into a column of recognized numerical value in the adjacent column through a formula.

If the result still looks like text, you need to change the cell’s number format. Select the cells, and in the Number group of the Home tab, choose “General” or “Number.”

The custom number formatting magic

Typing units directly into a cell (like “69 lbs”) turns your data into a text string, breaking any calculations that use this cell.

To ensure Excel recognizes the cell as a numerical one while keeping the unit, after deleting the text, select the column, press Ctrl+1, and in the Number tab of the Format Cells dialog, select “Custom.” Then, in the Type field, enter 0 “lbs” (or whichever unit you’re using). Note the double quotes here: they tell Excel to treat the text as a label while leaving the underlying number alone.

A column of data in Excel is selected, and the custom number format 0 "lbs" is typed into the Type field.

When you click “OK” to close the dialog, you’ll see that even though the cells contain the units, the formula bar displays only the numbers. This confirms that your data is clean and ready to be used in calculations.

An Excel table with values in a Weight column displaying 'lbs' after the values but the formula bar showing the number only.

Before you go full DIY with custom codes, check the other categories in the Number tab. For financial data or percentages, always use the built-in formats instead of custom strings. They handle things like negative number coloring and accounting alignment much better than a manual fix.

If you prefer a cleaner look, simply state the unit in the table header and keep the data underneath as raw numbers.

Surgical extraction: The modern TEXT family

The Text to Columns wizard is a classic, but if your data changes, you have to run the wizard again. If you’re using Excel for Microsoft 365, Excel 2024 or later, or Excel for the web, you should instead use the TEXT family of functions:

Function Purpose
TEXTBEFORE Extracts everything before a specific character.
TEXTAFTER Extracts everything after a specific character.
TEXTSPLIT Splits a string into multiple columns or rows.

For example, to extract people’s names from these email addresses and capitalize them at the same time, use this formula:

=PROPER(TEXTBEFORE([@Email],"@"))

This finds the “@” and grabs everything to its left. Because it’s a formula, it stays live—update the email or add a new one, and the person’s name updates instantly.

An Excel table with email addresses in column A, and the names extracted in column B using PROPER with TEXTBEFORE.

Likewise, if you want to extract only the domain, use TEXTAFTER. However, if you use TEXTSPLIT to split one column into two, you need to perform this operation in regular cells, as the spilled result can’t be displayed within an Excel table.

For massive datasets, use Power Query, the dedicated engine that can split, trim, and transform millions of rows of text without slowing down your workbook.

Importing data from external sources into Excel often brings invisible junk, like spaces and non-printing characters. In this example, when I run a LEN character count on the data code imported from the web, I should get 11: seven for the word “Product,” one for the space in the middle, and three for “452.” However, I get 15, meaning there are hidden characters.

A data code in column A of an Excel table, and the LEN formula revealing 15 characters, meaning there are hidden characters.

The old-school fix is a combination of TRIM (to remove extra spaces) and CLEAN (to strip out non-printing characters):

=TRIM(CLEAN([@Data]))

However, this still returns 12, not 11, meaning there’s a ghost character that TRIM is completely blind to.

TRIM and CLEAN used in MS Excel to remove hidden characters from a product code, and the LEN function proving the character count reduces.

If the data is imported from the web, this ghost character is almost always a non-breaking space, which TRIM can’t detect. In this case, use the SUBSTITUTE function, which can swap that web-style space for a standard one before the trim:

=TRIM(CLEAN(SUBSTITUTE([@Data],CHAR(160)," ")))

By nesting these, you force Excel to convert the non-breaking spaces—CHAR(160)—into something TRIM can see and strip away. When you run your LEN check again, you’ll hit that perfect 11.

TRIM, CLEAN, SUBSTITUTE, and CHAR used in Excel to remove spaces and non-printing characters.

Joining text: Why TEXTJOIN beats the ampersand

The old-school way to combine text in Excel was the ampersand (&):

=[@First]&" "&[@Last]
The first name Tom and last name Jones are concatenated in an Excel table using ampersands.

However, if a cell it references is empty, you end up with a string of double-spaces or repeated delimiters.

Concatenation in Excel resulting in a double-comma because one of the referenced cells is blank.

The more robust solution in Excel for Microsoft 365, Excel for the web, or Excel 2019 and later is the TEXTJOIN function. It allows you to set the delimiter once and, crucially, includes a setting to ignore empty cells:

=TEXTJOIN(", ",TRUE,T_Addresses[@[First_Line]:[City]])
TEXTJOIN used in Excel to concatenate parts of an address while ignoring blank cells.

By setting the second argument to TRUE, Excel skips any null values, ensuring your list looks professional regardless of gaps in the data.

For long descriptions or joined strings, click “Wrap Text” in the Home tab to keep your data visible without manually resizing columns. To force a line break, press Alt+Enter.

When a text pattern is too complex to solve with a formula, you can let Excel do the hard work for you. In this example, as soon as I start entering the zip codes from the address, Flash Fill picks up the pattern and offers to complete the column. Just press Tab or Enter to accept the suggestion.

Flash fill in Excel suggesting automatic completion of a column of zip codes based on the addresses in the adjacent column.

You can also press Ctrl+E to force Excel into this process if the suggestions don’t appear automatically.

The Formula by Example tool takes this further by actually generating the underlying formula for you. Start typing your pattern, and when Excel suggests a formula, click “Apply.” This is arguably more useful than Flash Fill because the resulting formula reacts to any changes in the original data and works on additional data added to the table.

Formula by Example in Excel for the web suggesting a formula to turn first and last names into initials.

Tip solutie

Permanent

Voteaza

(3 din 6 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?