ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to get rest of characters after last certain character? (https://www.excelbanter.com/excel-programming/436923-how-get-rest-characters-after-last-certain-character.html)

Wille

How to get rest of characters after last certain character?
 
Hi All,


e.g. In cell A1 there is a string = "dummy1\dummy3\cat\test"

In cell B1 I want result = "test"

In pseudo code:

test = functionX("dummy1\dummy3\cat\test"; "\" )

I don't want write visual basic code just use normal excel functions.

Is it possible to write this kind of function?

joel[_284_]

How to get rest of characters after last certain character?
 
Use INSTRREV

string = "dummy1\dummy3\cat\test"
string = mid(string,instrrev(string,"\") + 1)

The instrrev will find the position of the last back slash in the
string. You add one to get everything after the last back slash.


--
joel
------------------------------------------------------------------------
joel's Profile: http://www.thecodecage.com/forumz/member.php?userid=229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=158814

Microsoft Office Help


Ron Rosenfeld

How to get rest of characters after last certain character?
 
On Wed, 2 Dec 2009 05:20:37 -0800 (PST), Wille wrote:

Hi All,


e.g. In cell A1 there is a string = "dummy1\dummy3\cat\test"

In cell B1 I want result = "test"

In pseudo code:

test = functionX("dummy1\dummy3\cat\test"; "\" )

I don't want write visual basic code just use normal excel functions.

Is it possible to write this kind of function?


=TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",99)),99))

--ron

Wille

How to get rest of characters after last certain character?
 
On 2 joulu, 15:45, Ron Rosenfeld wrote:
On Wed, 2 Dec 2009 05:20:37 -0800 (PST), Wille wrote:
Hi All,


e.g. In cell A1 there is a string = "dummy1\dummy3\cat\test"
In cell B1 I want result = "test"


In pseudo code:


test = functionX("dummy1\dummy3\cat\test"; "\" )


I don't want write visual basic code just use normal excel functions.


Is it possible to write this kind of function?


=TRIM(RIGHT(SUBSTITUTE(A1,"\",REPT(" ",99)),99))


Thank you very much. This solved problem.


All times are GMT +1. The time now is 09:53 AM.

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