0

I'm using the following formula to extract a string from text in a cell by getting rid of -DCS.

The text contained in the cell: Q074-SARE_MANSONG-DCS

Formula:IF(ISNUMBER(SEARCH("DCS",H22)),LEFT(H22,FIND("@",SUBSTITUTE(H22,"-DCS","@",LEN(H22)-LEN(SUBSTITUTE(H22,"-",""))))-1),([@[<HELPER><SITE>]]))

Desired reslut: Q074-SARE_MANSONG

The problem is that it is not working for all cells. Can someone please tell me what it is that I'm doing wrong. Thanks.

1
  • next time make sure to post some sample data especially the ones that are not returning the expected result. Commented Aug 29, 2019 at 0:02

2 Answers 2

3

If "-DCS" is always at the end of the string:

=SUBSTITUTE(A1,"-DCS","")
Sign up to request clarification or add additional context in comments.

Comments

3

Use one of these formulas instead (assuming your data is in A1)

=left(A1,len(A1)-4) or =SUBSTITUTE(A1,"-DCS","")

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.