user5319388
user5319388

Reputation: 33

Extract all numbers after a character

I have a string like ssfdfksakf + 232332

Text, plus sign then number of any length.

I want the easiest way to extract the number without the whitespace or anything.

Upvotes: 0

Views: 1830

Answers (4)

pnuts
pnuts

Reputation: 59460

Take a copy and on that use Find & Select with Find what:

*

(there is a space after the asterisk) and Replace with: left blank.

Upvotes: 0

Ron Rosenfeld
Ron Rosenfeld

Reputation: 60199

This finds the first digit, then returns the rest of the string:

=MID(A1,MIN(FIND({0;1;2;3;4;5;6;7;8;9},A1&"0123456789")),99)

If you require the result to be numeric, then precede with a double unary:

=--MID(A1,MIN(FIND({0;1;2;3;4;5;6;7;8;9},A1&"0123456789")),99)

Upvotes: 2

Amit
Amit

Reputation: 46323

You could grab anything after the plus sign and then trim it:

=TRIM(MID(A1, FIND("+", A1) + 1, 999))

Upvotes: 1

user4039065
user4039065

Reputation:

You should convert the result to a true number with a double unary (aka double minus) after extracting the number portion as a string.

=--MID(A2, FIND("+", A2&"+ ")+1, 255)

Upvotes: 1

Related Questions