Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

PowerPivot extract text after different characters

I need to extract text after different delimiters.

I have used this which works for the ones which do have "-" however the data is not all uniform and some have these as delimiters as well:
"–" & "–" what way can I include these in the below code:

=TRIM(IF([Product]="","", VAR String = [Product]
VAR Items =
SUBSTITUTE (String, "-", "|" )
RETURN
PATHITEM ( Items, 2 )))

I have tried using ‘AND’ but I don’t believe I am doing it correct.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Thanks for any assistance in advance.

>Solution :

=TRIM(
  IF([Product]="", 
    "", 
    VAR String = [Product]
    VAR Items = SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(String, "–", "|"), "--", "|"), "-", "|")
    RETURN PATHITEM(Items, 2)
  )
)

This way, no matter which of the delimiters is used, it will be replaced by "|", and PATHITEM will correctly extract the second part of the string.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading