Count the character number behind a certain character

Rav_Singh

New Member
Joined
Jun 29, 2019
Messages
28
I hope someone can assist with this question.

I require to understand the number of characters behind the final '\' character.

Example:

Monday\Tuesday\Wednesday

Answer in next cell = 14 (14 characters behind the final '\')

Or is a possible solution to count where the final '\' is in a cell?

This seems a workable challenge but alas I have failed to come up with a solution.

As always any help will be greatly appreciated.


Rav
 
Last edited:

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
How about
=LEN(TRIM(RIGHT(SUBSTITUTE(A2,"",REPT(" ",100)),100)))
although I make the answer 9 not 14
 
Upvote 0
Hi,

Assuming 9 is a suitable upper bound on the number of slashes in the string:

=-LOOKUP(1,-FIND("ζ",SUBSTITUTE(A1,"","ζ",{1;2;3;4;5;6;7;8;9})))-1

Regards
 
Upvote 0
Hey how about this:

=SEARCH("|",SUBSTITUTE(A2,CHAR(92),"|",LEN(A2)-LEN(SUBSTITUTE(A2,CHAR(92),""))))-1

Note if text contains the pipe character this will return incorrect, try change both cases of "|" to "|¬" or something else obscure.
 
Last edited:
Upvote 0
This almost works but continues to count back from the first '\' rather than the last '\' from the string.

Appreciate your help on this.

Hi,

Assuming 9 is a suitable upper bound on the number of slashes in the string:

=-LOOKUP(1,-FIND("ζ",SUBSTITUTE(A1,"","ζ",{1;2;3;4;5;6;7;8;9})))-1

Regards
 
Upvote 0
Hi Fluff,

Appreciate your input on this. When I apply this formula to a more complicated string, then the numbers veer to the high side.
 
Upvote 0
Hi Tyija,

Unfortunately when I apply this formula I get the #VALUE! message.

Appreciate your efforts to assist.

Hey how about this:

=SEARCH("|",SUBSTITUTE(A2,CHAR(92),"|",LEN(A2)-LEN(SUBSTITUTE(A2,CHAR(92),""))))-1

Note if text contains the pipe character this will return incorrect, try change "|" to "|¬" or something else obscure.
 
Upvote 0
Hi Tyija,

Unfortunately when I apply this formula I get the #VALUE ! message.

Appreciate your efforts to assist.

Hey, thanks for the feedback - did the string you referenced (assuming it's A2) contain any backslashes (\) ?
 
Upvote 0
If the formulae you have been provided with don't work, then please supply a sample of the data where they don't work.
 
Upvote 0
Yes in A2 the string contained two '\'. Was hoping to count the characters behind the final '\' in the string as some cells contain more/less '\' character.

Hey, thanks for the feedback - did the string you referenced (assuming it's A2) contain any backslashes (\) ?
 
Last edited:
Upvote 0

Forum statistics

Threads
1,223,164
Messages
6,170,444
Members
452,326
Latest member
johnshaji

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