Forum Discussion
Rachwar30
Sep 02, 2022Copper Contributor
Extracting numbers before string characters start
Hi all, I am looking for an excel formula that can help me to extract numbers only from a mix of numbers and characters ONLY before the first character starts (i.e sometimes there are numbers aft...
- Sep 02, 2022
Presuming your text is in A2, you might use:
=LEFT(A2,MIN(IFERROR(SEARCH(CHAR(SEQUENCE(26,,65,1)),A2),""))-1)
CourtneyTX
Dec 11, 2024Copper Contributor
Patrick2788I just used this to help me extract numbers from a difficult text string today! I'd love to understand how these functions are working together. Can you explain?
Patrick2788
Dec 12, 2024Silver Contributor
Much has changed in two years.
An even easier solution:
=REGEXEXTRACT(A1,"^\d+")^ -indicates to start at the first character in the string
\d - any digit
+ is added to indicate "1 or more digits"