Home Topics excel Excel: Extract number from text string

Excel: Extract number from text string

Apr 08, 2025 am 10:29 AM

This tutorial demonstrates how to extract numbers from various text strings within Excel using formulas and the Extract tool. Excel offers the Left, Right, and Mid substring functions for extracting text of a specific length, but lacks a dedicated function for extracting numbers from alphanumeric strings. This requires a combination of functions or the use of an extraction tool.

Methods for Extracting Numbers:

  • Extracting from the Right: For numbers appearing at the end of a string, use this formula (replace A2 with your cell reference):

     =IFERROR(VALUE(RIGHT(A2, LEN(A2) - MAX(IF(ISNUMBER(MID(A2, ROW(INDIRECT("1:"&LEN(A2))), 1)*1)=FALSE, ROW(INDIRECT("1:"&LEN(A2))), 0)))), "")

    This formula uses RIGHT, LEN, MAX, IF, ISNUMBER, MID, and ROW functions to identify and extract the trailing number. The IFERROR and VALUE functions handle potential errors and ensure a numerical result. In older Excel versions, this is an array formula (Ctrl Shift Enter).

    Excel: Extract number from text string

  • Extracting from the Left: For numbers at the beginning of a string, use this formula (replace A2 with your cell reference):

     =LEFT(A2, MATCH(FALSE, ISNUMBER(MID(A2, ROW(INDIRECT("1:"&LEN(A2) 1)), 1)*1), 0) -1)

    This formula uses LEFT, MATCH, ISNUMBER, MID, and ROW functions to find the first non-numeric character and extract the preceding numbers. In older Excel versions, this is an array formula (Ctrl Shift Enter).

    Excel: Extract number from text string

  • Extracting from Anywhere: For numbers located anywhere within a string, a more complex formula is needed:

     =IF(SUM(LEN(A2)-LEN(SUBSTITUTE(A2, {"0","1","2","3","4","5","6","7","8","9"}, "")))>0, SUMPRODUCT(MID(0&A2, LARGE(INDEX(ISNUMBER(--MID(A2,ROW(INDIRECT("$1:$"&LEN(A2))),1))* ROW(INDIRECT("$1:$"&LEN(A2))),0), ROW(INDIRECT("$1:$"&LEN(A2)))) 1,1) * 10^ROW(INDIRECT("$1:$"&LEN(A2)))/10),"")

    This formula directly returns a numerical value.

    Excel: Extract number from text string

  • Using the Extract Tool (Ultimate Suite): The Ablebits Ultimate Suite provides a user-friendly "Extract" tool. Select your cells, choose "Extract numbers," and click "Insert Results." You can choose to insert as formulas or values.

    Excel: Extract number from text string

Downloadable Resources:

  • Sample workbook (.xlsx)
  • Ultimate Suite trial version (.exe)

This revised output maintains the original meaning while rephrasing sentences and using slightly different wording. The image placements remain unchanged.

The above is the detailed content of Excel: Extract number from text string. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot AI Tools

Undress AI Tool

Undress AI Tool

Undress images for free

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)