extract a value from a text string

Is there a way I can extract the cost value from a string of characters to give me a total from a pasted list - example below

2 x Cravendale Purefilter Whole Milk 1L 	 Total Price £2.30
4 x Sainsbury's Ready Salted Crisps 6x25g 	 Total Price £3.40
2 x Cravendale Purefilter Whole Milk 1L 	 Total Price £2.30
1 x Robinsons Orange & Pineapple Squash No Added Sugar 1L 	 Total Price £1.65

the price always includes the text of Total Price £2.30

edited Example-data for readability

@inearlygaveup:
Can you assure the pound sign £ - or may there also occur GBP?
Can you assure that no “thousands grouping” will ever occur? If not: What group separator(s) might be used?
Do you want to explicitly assure that there will not be any trailing space? Or a space between £ and the first digit? Or a sign (in exceptional cases of refunds e.g.)?

Extraction from strings always depends on an unambiguous syntax allowing to recognize the part(s) needing to get extracted. False positive may be as bad as false negative when parsing. As few examles as you gave often suggest the applicability of a solution that later will fail due to an unmentioned -and not exemplified- “special case”.

Hi @inearlygaveup, use the form below:

=RIGHT(B3;LEN(B3)-SEARCH(" £";B3;1))


ATENÇÂO:: Para dar mais detalhes a sua pergunta, use Descrição da imagem na pergunta ou Descrição da imagem abaixo. Não use Adicionar resposta para comentário. Grato.

Caso a resposta atendeu sua necessidade, por gentileza, click na bolinha Descrição da imagem a esquerda da resposta, para finalizar a pergunta.

Hello

assuming the 4 line are in cells A1 through A4 you may use:

=REGEX(A2;"£[:digit:]+\.[:digit:]{2}$") or (even better to get rid of superfluous space characters)
=REGEX(TRIM(A2);"£[:digit:]+\.[:digit:]{2}$")

See the following sample file: ExtractPriceFromString.ods

Hope that helps.

Schiavinatto - Thank you very much

Please do not use add reply to comments. Delete and use Add a Comments in the response.


Please do **not** use *Add Answer* if you actually don't answer a question but commenting an answer or responding to another user’s comment. Please use ***add a comment*** for that purpose. Thanks in advance …