BS

Wednesday, August 7, 2019

Excel - Formule

 

Contents

1       Split a text based on one character. 1

2       Extract Text. 1

2.1         Extract remaining string after last backslash. 1

2.2         Extract afater 2nd instance of #  - with example to be provided xxx. 1

 

 

1         Split a text based on one character

Text

LeftFormula

LeftValue

RightFormula

RightValue

abcd=123

=LEFT(A2,FIND("=",A2,1)-1)

abcd

=RIGHT(A2,LEN(A2)-FIND("=",A2))

123

 

2         Extract Text

2.1        Extract remaining string after last backslash

File Path

File Name

Formula

F:\MainFolder\SubFolder\FileName.docx

FileName.docx

=TRIM(RIGHT(SUBSTITUTE(B3,"\",REPT(" ",LEN(B3))),LEN(B3)))

F:\MainFolder\SubFolder\FileName.docx

F:

=TRIM(LEFT(SUBSTITUTE(B4,"\",REPT(" ",LEN(B4))),LEN(B4)))

 

2.2        Extract afater 2nd instance of #  - with example to be provided xxx

File Path

File Name

Formula

right words after 2nd _ character

=TRIM(MID(A2,FIND("#",SUBSTITUTE(A2,"_","#",1))+1,255))     

left words after 2nd _ character

=TRIM(MID(A2,1,FIND("#",SUBSTITUTE(A2,"_","#",2))-1))