SEARCH - but from Right to Left...

Aitch

Board Regular
Joined
Jan 27, 2019
Messages
119
Office Version
  1. 2010
Platform
  1. Windows
I have data in a column which looks something like this:

1X3456789 - SEARCH ("X" , A1) = 2
234X73876 - SEARCH ("X" , A2) = 4
839030X38 - SEARCH ("X" , A3) = 7

Is there a way to SEARCH in reverse so it looks from Right to Left ??

1X3456789 - reverseSEARCH ("X" , A1) = 8
234X73876 - reverseSEARCH ("X" , A2) = 6
839030X38 - reverseSEARCH ("X" , A3) = 3


Thank you for any help!
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
so assume your first one is in cell a1, do =len(a1)-search("x",a1)
 
Upvote 0
How about
=LEN(A1)- SEARCH ("X" , A1)+1
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0
Sorry for bothering everyone once more!

If the cell has 2 or more X - it gives the first instance from the Left... how can I still get the first instance from the Right?

1X3456X89 - LEN(A1) - SEARCH ("X" , A1) +1 = 2 but needs to be 3
234XX3876 - LEN(A2) - SEARCH ("X" , A2) +1 = 4 but needs to be 5
23X76X35X - LEN(A3) - SEARCH ("X" , A3) +1 = 3 but needs to be 1


Also, this is the formula I'm using to leave the result empty if there is no X - but is there a better/cleaner way?

=IF (IFERROR (SEARCH ("P" , A1) , "") = "" , "" , LEN(A1) - SEARCH ("P" , A1) +1)


Thanks again!
 
Upvote 0
How about
+Fluff New.xlsm
AB
1
21X3456X893
3234XX38765
423X76X35X1
Master
Cell Formulas
RangeFormula
B2:B4B2=LEN(A2)-SEARCH("|",SUBSTITUTE(A2,"X","|",LEN(A2)-LEN(SUBSTITUTE(A2,"X",""))))+1
 
Upvote 0

Forum statistics

Threads
1,214,392
Messages
6,119,255
Members
448,879
Latest member
oksanana

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