Data Cleaning: Convert K And M Suffix Text To Numbers

Excel Formulas › Data Cleaning

All versions

Exports from social, ad and CRM tools often show numbers like 12.5K and 3.2M. They look like numbers but are text, so SUM ignores them. Check the last character with RIGHT, strip it with LEFT and LEN, and multiply by 1,000 or 1,000,000; anything without a suffix just goes through VALUE.


Quick formula: Test the suffix, strip it and scale:
=IF(UPPER(RIGHT(B2,1))="K",LEFT(B2,LEN(B2)-1)*1000,IF(UPPER(RIGHT(B2,1))="M",LEFT(B2,LEN(B2)-1)*1000000,VALUE(B2)))

The text 12.5K becomes the number 12,500, and 3.2M becomes 3,200,000.

Functions used (tap for the full reference guide):

The example

Three worked examples. Change any yellow input in the practice workbook and the results recalculate.

ABC
1CaseTextNumber
2Impressions12.5K12,500
3Video views3.2M3,200,000
4Clicks850850

The formula

Here is the formula, built directly from the inputs:

=IF(UPPER(RIGHT(B2,1))="K",LEFT(B2,LEN(B2)-1)*1000,IF(UPPER(RIGHT(B2,1))="M",LEFT(B2,LEN(B2)-1)*1000000,VALUE(B2))) // Number

How it works

Here is the logic, one piece at a time:

  1. RIGHT(B2,1) reads the suffix.
  2. LEFT(B2,LEN(B2)-1) drops it.
  3. Multiplying by 1000 or 1000000 also converts the text to a number.
  4. VALUE(B2) handles plain numbers stored as text.

Keep every number in its own input cell so the formula never needs editing.

Try it: interactive demo

Interactive

Enter the values below.

Variations

Add billions

Handle a B suffix as well.

=IF(UPPER(RIGHT(B2,1))="B",LEFT(B2,LEN(B2)-1)*10^9,C2)

Strip spaces first

Clean values like " 4.1K ".

=TRIM(B2)

Pitfalls & errors

Lowercase k slips past a case-sensitive test; UPPER makes the check reliable.

Values like 1.2K are already rounded, so totals are approximate.

Paste the results as values once converted so you can delete the text column.

Practice workbook

Frequently asked questions

Why does SUM ignore 12.5K?
It is text, and SUM skips text.
Is there a single function for this?
No built-in one; the nested IF is the usual approach.

Stop fighting formulas. Learn them in a day.

This recipe is one of hundreds of real-world formulas we teach. Our Excel Formulas & Functions class covers lookups, logic, text, and dynamic arrays hands-on — live in Dallas–Fort Worth, Houston, Austin, Oklahoma City, Denver, or online.

See the Formulas & Functions Class

Related formulas: Standardize Phone Number Format · Clean Currency Text to a Number · Remove Non-Breaking Spaces (TRIM Won't)

Function references: RIGHTLEFTLENVALUEIF