If textbefore/textafter with double quotes

UT_Princess

New Member
Joined
Nov 6, 2019
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I have a field in column A and i want to get the text after PROJ_ but before either ,TR or ",TR. I can get the formula to work if there is not a " but when there is I'm getting an error and formula will not solge

Col ACol BCol CCol D
FieldDesired ResultFormulaResult
Base,USD_Reporting,FY24,TI,TD,LOC_CUST,SUB_ABC,Forecast,Load,PROJ_projectnameA,TRprojectnameATEXTBEFORE(TEXTAFTER(A2,"PROJ_"),",TR")projectnameA
Base,USD_Reporting,FY24,TI,TD,LOC_CUST,SUB_DSS,Forecast,Load,PROJ_projectnameB",TRprojectnameBif(right(TEXTBEFORE(TEXTAFTER(N2,"PROJ_"),",TR"),1)=""",(TEXTBEFORE(TEXTAFTER(N2,"PROJ_"),"",TR")),(TEXTBEFORE(TEXTAFTER(N2,"PROJ_"),",TR"))Formula will not process (it highlights the second "PROJ_")
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
How about
Excel Formula:
=SUBSTITUTE(TEXTBEFORE(TEXTAFTER(A2,"PROJ_"),",TR"),CHAR(34),"")
 
Upvote 0
How about
Excel Formula:
=SUBSTITUTE(TEXTBEFORE(TEXTAFTER(A2,"PROJ_"),",TR"),CHAR(34),"")
Some of the projects and locations have different lengths. So original field could be like:

Base,USD_Reporting,FY24,TI,TD,LOC_ABC,SUB_ABC,Forecast,Load,PROJ_projectnamemaybeA,TR
Base,USD_Reporting,FY24,TI,TD,LOC_PQRSTZ,SUB_ABC,Forecast,Load,PROJ_projectnameforA,TR
Base,USD_Reporting,FY24,TI,TD,LOC_CUST,SUB_ABC,Forecast,Load,PROJ_projectnamegA,TR
 
Upvote 0
That makes no difference.
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,221,595
Messages
6,160,701
Members
451,665
Latest member
PierreF

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