Sorter Formula

Rubber Beaked Woodpecker

Board Regular
Joined
Aug 30, 2015
Messages
205
Office Version
  1. 2021
The following formula works very well but just curious if there is an easier/shorter way of writing the formula?

=IF(AND(LEFT(A65,1)="1",(RIGHT(A65,1)<>"t")),SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(SUBSTITUTE(A65,"1",""),"2",""),"3",""),"4",""),"5",""),"6",""),"7",""),"8",""),"9",""),"/",""),"")

Thanks

RBW
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.
Personally, I would use a UDF. Something like this:
VBA Code:
Function RBW(r As Range) As String
    Dim i As Long, s As String, a
    a = Array("1", "2", "3", "4", "5", "6", "7", "8", "9")
    If Left(r, 1) = 1 And Right(r, 1) <> "t" Then
        s = r.Value
        For i = LBound(a) To UBound(a)
            s = Replace(s, a(i), "")
        Next
        RBW = Trim(s)
    Else
        RBW = r
    End If
End Function

Then the formula becomes simpler to enter:
Book1
AB
113 leave 1111leave
2leave 123 123leave 123 123
3123 leaveleave
41 321 312 321 312 
5321 321 321 t321 321 321 t
61 999 111 ttt 999ttt
7123456789 
8123456789 t123456789 t
Sheet1
Cell Formulas
RangeFormula
B1:B8B1=RBW(A1)
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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