Return position character first appears in a text string from the right hand side

nightracer

Board Regular
Joined
May 17, 2004
Messages
147
Office Version
  1. 365
Hi all, I'm trying to return the character position of "(" in each cell working from the right hand side, so for example:

Cell A1
John Smith (GB) (22.13)
Cell A2
Adrian Blackshaw (IRE) (4.2)
Cell A3
Patrick Lourel (103.00)

So I just want the position of the final "(" in the string (before the numbers) in each case?
Some cells will have more than one "(" as above, others only one "(".
I've tried LEN, FIND etc but can't get it to work?

Many thanks
N
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
What version of Excel are you using?

I suggest that you update your Account details (or click your user name at the top right of the forum) so helpers always know what Excel version(s) & platform(s) you are using as the best solution often varies by version. (Don’t forget to scroll down & ‘Save’)
 
Upvote 0
Thanks Fluff, I'm on 365.
I have updated my profile, thanks for the advice.

Many thanks
N
 
Upvote 0
Try this:
Book1
AB
1John Smith (GB) (22.13)7
2Adrian Blackshaw (IRE) (4.2)5
Sheet1
Cell Formulas
RangeFormula
B1:B2B1=MATCH("(",MID(A1,LEN(A1)-SEQUENCE(LEN(A1))+1,1),0)

Assuming you want to begin counting from the right side...or do you want to count characters from the left side and find the rightmost occurrence?
 
Upvote 0
I have updated my profile, thanks for the advice.
Thanks for that. (y)
How about
Excel Formula:
=LEN(TEXTBEFORE(A1,"(",-1))+1
or
Excel Formula:
=LEN(TEXTAFTER(A1,"(",-1))+1
Not sure if you want to count from the left or right.
 
Upvote 0
Many thanks KRice and Fluff, it ws to count from the left, so really appreciate it, that's sorted it. :)

Thanks again
N
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Glad to help. Here's a variation on my approach using XMATCH, which has a argument to change the search direction. Using that feature to search an array of single characters representing the text string in either forward or reverse order effectively changes the counting baseline point (either from left or from right). That said, I still prefer Fluff's offering...an elegant solution. Here are both showing from-left and from-right solutions:
Book1
ABC
1John Smith (GB) (22.13)717
2John Smith (GB) (22.13)717
Sheet1
Cell Formulas
RangeFormula
B1B1=LEN(TEXTAFTER(A1,"(",-1))+1
C1C1=LEN(TEXTBEFORE(A1,"(",-1))+1
B2B2=XMATCH("(",MID(A2,LEN(A2)-SEQUENCE(LEN(A2))+1,1),,1)
C2C2=XMATCH("(",MID(A2,SEQUENCE(LEN(A2)),1),,-1)
 
Upvote 0
I'm wondering (guessing) if you want to know this position so that you can then split the text into columns?
If so, instead of finding the "(" position, you might be able to do the split directly? (Couple of options re the final number)

23 12 04.xlsm
ABCD
1John Smith (GB) (22.13)John Smith (GB)(22.13)22.13
2Adrian Blackshaw (IRE) (4.2)Adrian Blackshaw (IRE)(4.2)4.2
3Patrick Lourel (103.00)Patrick Lourel(103.00)103
nightracer
Cell Formulas
RangeFormula
B1:B3B1=TEXTBEFORE(A1," ",-1)
C1:C3C1=TEXTAFTER(A1," ",-1)
D1:D3D1=-TEXTAFTER(A1," ",-1)
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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