Extract price from text string

tigerme

New Member
Joined
Jan 2, 2022
Messages
2
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi. Please help, I need to extract the price from a text string - they've taken out the currency symbol so it's just the number format #.##

For example

'Spiderman: Web Of Shadows - Amazing Allies Edition (Sony PSP) Game Spanish Box';angelicxrose6_3 Final price: 8.95 (Buy it now).

To return a value of 8.95

or

1641134683025.png


to return a value of 27.56

it's always before an open bracket (

Thanks in advance!
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
is it always following price:

how about
=MID(A2,SEARCH("price:",A2,1)+6,MATCH(2,1/(MID(A2,SEQUENCE(LEN(A2)),1)="("))-(SEARCH("price:",A2,1)+6))*1

Book2
ABCD
1
2((( Price: 213.56 ( )213.56
3Spiderman: Web Of Shadows - Amazing Allies Edition (Sony PSP) Game Spanish Box';angelicxrose6_3 Final price: 8.95 (Buy it now).8.95
4
5
Sheet1
Cell Formulas
RangeFormula
D2:D3D2=MID(A2,SEARCH("price:",A2,1)+6,MATCH(2,1/(MID(A2,SEQUENCE(LEN(A2)),1)="("))-(SEARCH("price:",A2,1)+6))*1
 
Upvote 0
Assuming that it always follows "price" and precedes the opening bracket, here are a couple of other possibilities . . .

=TRIM(LEFT(MID(A1,FIND("price:",A1)+6,LEN(A1)),FIND("(",MID(A1,FIND("price:",A1)+6,LEN(A1)))-1))

or

=LET(s,TRIM(MID(A1,FIND("price:",A1)+6,LEN(A1))),TRIM(LEFT(s,FIND("(",s)-1)))
 
Upvote 0
For Windows only
If it's always the last number, another option
Excel Formula:
=FILTERXML("<k><m>"&SUBSTITUTE(A2," ","</m><m>")&"</m></k>","//m[.=number()][last()]")
Alternatively, if it's always preceded by "price"
Excel Formula:
=FILTERXML("<k><m>"&SUBSTITUTE(A2," ","</m><m>")&"</m></k>","//m[.='price:']/following::m[1]")
 
Upvote 0
How about

Excel Formula:
=TRIM(MID(A1,SEARCH("?.??",A1)-1,5))
 
Upvote 0
Another option available is with Power Query/Get and Transform Data found on the Data Tab

Power Query:
let
    Source = Excel.CurrentWorkbook(){[Name="Table1"]}[Content],
    #"Extracted Text Between Delimiters" = Table.TransformColumns(Source, {{"Column1", each Text.BetweenDelimiters(_, ":", "(", {0, RelativePosition.FromEnd}, 0), type text}})
in
    #"Extracted Text Between Delimiters"
 
Upvote 0
Try

Excel Formula:
=TRIM(LEFT(MID(A1,SEARCH("Price:",A1)+7,99),SEARCH("(",MID(A1,SEARCH("Price:",A1)+7,99))-1))+0
 
Last edited:
Upvote 0
A variation on @Domenic's theme
=LET(s,REPLACE(A1,1,FIND("price:",A1)+5,""),LEFT(s,FIND(" (",s))+0)
 
Upvote 0
Solution
One way:

=AGGREGATE(14,6,--MID(A1,SEARCH("Price:",A1)+7,SEQUENCE(LEN(A1))),1)

=LOOKUP(10^35,--MID(A1,SEARCH("Price:",A1)+7,SEQUENCE(LEN(A1))))
 
Upvote 0
Thank you everyone, that has done the trick! Each of them have worked which has given me food for thought but #8 was the quick and simple solution!
 
Upvote 0

Forum statistics

Threads
1,223,445
Messages
6,172,177
Members
452,446
Latest member
walkman99

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top