A formula can extract the number from entries such as 10ft or 100 pairs, but the most reliable solution is to keep the numeric value and the unit in separate columns. This prevents calculation errors and makes inventory reports easier to filter, sort and automate.
The problem
This issue came up in the r/excel community when someone was calculating price per item for inventory. A formula such as =A1/B1 works when A1 contains a price and B1 contains a number, such as a $10 pack divided into 5 items. The result is $2 per item.
The problem starts when the quantity cell contains both a number and text, such as 10ft or 100 pairs. Excel treats those entries as text, not as numeric cell values. A division formula cannot use them directly, so it returns an error.
The original discussion is available in the r/excel question about ignoring letters in cells.
Microsoft explains that numbers stored as text can produce unexpected formula results. Its recommended VALUE function can convert text that contains a valid number into a numeric value, but it does not solve every mixed entry that includes units.
The solution
Restructure the inventory table so the number and unit are stored separately:
| Product | Pack price | Quantity | Unit | Price per unit |
|---|---|---|---|---|
| Cable | 10 | 10 | ft | 1 |
| Gloves | 10 | 100 | pairs | 0.10 |
With the price in B2 and the quantity in C2, use:
=B2/C2
B2 is the pack price. The division operator / divides that price by the numeric quantity in C2. The result is the price per unit.
This is better than asking a formula to ignore letters because the workbook keeps data in a usable structure. You can calculate, sort, filter and summarize the quantity without cleaning the cell first.
You can still show the unit beside the quantity. Put ft, pairs, kg or another label in the Unit column. This also handles products with different measurement types without hiding information inside a text string.
If the unit must appear in the same cell for printing or presentation, use custom number formatting instead of typing the unit into the value. For example, a numeric cell containing 10 can display as 10 ft while remaining a number for calculations. In desktop Excel, select the cells, open Format Cells, choose Custom, and add the unit in quotation marks, such as:
0 "ft"
The 0 displays the numeric value. The text in quotation marks displays ft. Custom number formats change how a value looks without changing the underlying number. Microsoft notes that custom formats cannot be created directly in Excel for the web, so use the desktop application for this setup.
How to apply it
Make a copy of the inventory workbook before changing the structure.
Add a Quantity column beside the current column that contains entries such as
10ftor100 pairs.Add a Unit column next to Quantity.
Enter only the numeric portion in Quantity. Enter
10instead of10ft, and100instead of100 pairs.Enter the measurement in Unit. Use
ftfor feet andpairsfor pairs.Move the price into its own numeric column if it currently includes a currency symbol as text. A value such as
10can still display as currency through number formatting.Replace the old calculation with
=B2/C2, adjusting the column references to match your workbook.Fill the formula down the table by dragging the fill handle or copying the formula to the remaining rows.
Format the result as currency or as a number with the required decimal places.
If the unit must be visible inside the quantity cell, select the numeric Quantity cells and open Format Cells.
Choose Custom and enter a format such as
0 "ft"for feet or0 "pairs"for pairs.Test several products before deleting the old column. Include whole numbers, decimals, zero quantities and blank rows.
For an existing workbook that already contains mixed text, use a temporary cleanup column rather than manually editing every row. Microsoft recommends VALUE for text that represents a valid number, using a formula such as =VALUE(E2). This works when E2 contains numeric text, but entries such as 10ft may need a separate cleaning step because the unit is attached to the number.
A formula that extracts digits from arbitrary text can be built, but it is usually less robust for inventory. It may mishandle decimals, negative values, thousands separators or entries containing more than one number. Separating the fields avoids those risks.
If different rows use different units, do not convert them into one total unless the measurements are genuinely comparable. Ten feet, ten meters and ten pairs are different quantities. Keeping the unit in a separate column makes that difference visible.
Implementation angle
For a small inventory, separate Quantity and Unit columns provide a clean foundation for importing products into Zoho Creator or another database-style application. An automation in Make or n8n can validate that Quantity is numeric, check that Unit is present, and calculate price per unit before sending the record to accounting or reporting tools. Claude can also help review the workbook for mixed text values and generate cleanup formulas, but the final structure should keep numbers and labels separate.
For businesses managing larger inventories with multiple warehouses or stock locations, Zoho Inventory offers multi-warehouse tracking and automated reorder points that work seamlessly with properly structured data. When your spreadsheet outgrows manual management, structured data entry forms can enforce the separation of quantity and unit fields at the point of entry, preventing mixed-format errors before they occur.
Book an AI implementation engagement with Creator Scripts at creatorscripts.com.
Frequently asked questions
How can I separate numbers and units in Excel?
You can create separate columns for the numeric value and the unit in your Excel sheet. For example, have one column for quantity and another for the unit label like "ft" or "pairs." This method prevents calculation errors and makes your data easier to work with.
What happens if my quantity cell contains text?
When your quantity cell includes both numbers and text, like "10ft," Excel treats it as text instead of a numeric value. This can cause errors in formulas that expect numeric inputs, such as division. To fix this, you should store the number and the unit in different columns.
Can I format a cell to display units without changing the underlying value?
Yes, you can use custom number formatting in Excel to display units next to a numeric value. For instance, you can format a cell to show "10 ft" while keeping it as a number for calculations. This is done by selecting the cell, choosing Custom format, and adding your unit in quotation marks.