ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Truncate string (https://www.excelbanter.com/excel-programming/377003-truncate-string.html)

bwmaher

Truncate string
 
I want to truncate the portion of a string that follows my third "\".
So data looks like, C:\TEMP\RESULTS\FINANCE\3q\Findings and I want just
C:\TEMP\RESULTS\FINANCE\

Gary''s Student

Truncate string
 
Your example does not match your request, but anyway:

s = "C:\TEMP\RESULTS\FINANCE\3q\Findings"
t = "\"
U = Split(s, t)
s = U(0) & t & U(1) & t & U(2) & t
--
Gary's Student


"bwmaher" wrote:

I want to truncate the portion of a string that follows my third "\".
So data looks like, C:\TEMP\RESULTS\FINANCE\3q\Findings and I want just
C:\TEMP\RESULTS\FINANCE\


Gary Keramidas

Truncate string
 
here's a formula that should work if the string is in A1

=LEFT(A1,FIND(CHAR(7),SUBSTITUTE(A1,"\",CHAR(7),3) ))
--


Gary


"bwmaher" wrote in message
...
I want to truncate the portion of a string that follows my third "\".
So data looks like, C:\TEMP\RESULTS\FINANCE\3q\Findings and I want just
C:\TEMP\RESULTS\FINANCE\




bwmaher

Truncate string
 
Thank you, Gary. it worked perfectly.

"Gary Keramidas" wrote:

here's a formula that should work if the string is in A1

=LEFT(A1,FIND(CHAR(7),SUBSTITUTE(A1,"\",CHAR(7),3) ))
--


Gary


"bwmaher" wrote in message
...
I want to truncate the portion of a string that follows my third "\".
So data looks like, C:\TEMP\RESULTS\FINANCE\3q\Findings and I want just
C:\TEMP\RESULTS\FINANCE\






All times are GMT +1. The time now is 06:33 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com