Excel: Extract number from text string
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)))), "")
Copy after loginThis formula uses
RIGHT
,LEN
,MAX
,IF
,ISNUMBER
,MID
, andROW
functions to identify and extract the trailing number. TheIFERROR
andVALUE
functions handle potential errors and ensure a numerical result. In older Excel versions, this is an array formula (Ctrl Shift Enter). -
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)
Copy after loginThis formula uses
LEFT
,MATCH
,ISNUMBER
,MID
, andROW
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). -
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),"")
Copy after loginThis formula directly returns a numerical value.
-
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.
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!

Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

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

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

This tutorial demonstrates how to efficiently locate the top N values within a dataset and retrieve associated data using Excel formulas. Whether you need the highest, lowest, or those meeting specific criteria, this guide provides solutions. Findi

This tutorial shows you how to add dropdown lists to your Outlook email templates, including multiple selections and database population. While Outlook doesn't directly support dropdowns, this guide provides creative workarounds. Email templates sav

This tutorial provides a comprehensive guide to Excel's Flash Fill feature, a powerful tool for automating data entry tasks. It covers various aspects, from its definition and location to advanced usage and troubleshooting. Understanding Excel's Fla

In this tutorial, you'll learn how to use regular expressions in Excel to find and extract substrings matching a given pattern. Microsoft Excel provides a number of functions to extract text from cells. Those functions can cope with most

This article explains how to access and utilize shared calendars within the Outlook desktop application, including importing iCalendar files. Previously, we covered sharing your Outlook calendar. Now, let's explore how to view calendars shared with

This tutorial explains how to use Excel's FV function to determine the future value of investments, encompassing both regular payments and lump-sum deposits. Effective financial planning hinges on understanding investment growth, and this guide prov

This tutorial explains how to calculate the median of numerical data in Excel using the MEDIAN function. The median, a key measure of central tendency, identifies the middle value in a dataset, offering a more robust representation of central tenden

This tutorial demonstrates several methods for separating text and numbers within Excel cells, utilizing both built-in functions and custom VBA functions. You'll learn how to extract numbers while removing text, isolate text while discarding numbers
