Remove all before first lower case character

xluserg

Board Regular
Joined
Jan 30, 2010
Messages
121
Office Version
  1. 365
Platform
  1. Windows
Hi all

How would I remove everything before a lower case character


In column M
I have starting at M10:60






example


3263 7 h
3502U- 10 ht
445334 11 t
35-409 6
3-355P 7 w 1 v
936423 7
120-PP 9
7-0565 4
/34303 9 h 1
P78062 8
75566F 4 b
/34-PU 8 t




would leave




h
ht
t
blank cell
w 1 v
blank cell
blank cell
blank cell
h 1
blank cell
b
t




Thanks all in advance

Graham
 

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Try:

MN
3263 7 hh
3502U- 10 htht
445334 11 tt
35-409 6
3-355P 7 w 1 vw 1 v
936423 7
120-PP 9
7-0565 4
/34303 9 h 1h 1
P78062 8
75566F 4 bb
/34-PU 8 tt

<tbody>
[TD="align: center"]10[/TD]

[TD="align: center"]11[/TD]

[TD="align: center"]12[/TD]

[TD="align: center"]13[/TD]

[TD="align: center"]14[/TD]

[TD="align: center"]15[/TD]

[TD="align: center"]16[/TD]

[TD="align: center"]17[/TD]

[TD="align: center"]18[/TD]

[TD="align: center"]19[/TD]

[TD="align: center"]20[/TD]

[TD="align: center"]21[/TD]

</tbody>
Sheet12

[TABLE="width: 85%"]
<tbody>[TR]
[TD]Worksheet Formulas[TABLE="width: 100%"]
<tbody>[TR="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]
[TH]Cell[/TH]
[TH="align: left"]Formula[/TH]
[/TR]
[TR]
[TH="bgcolor: [URL=https://www.mrexcel.com/forum/usertag.php?do=list&action=hash&hash=DAE7F5]#DAE7F5[/URL] "]N10[/TH]
[TD="align: left"]=IFERROR(MID(M10,AGGREGATE(15,6,FIND(ROW(INDIRECT("97:122"))),M10),1),LEN(M10)),"")[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
</tbody>[/TABLE]
 
Upvote 0
Your formula is missing the CHAR function:
=IFERROR(MID(A1,AGGREGATE(15,6,FIND(CHAR(ROW(INDIRECT("97:122"))),A1),1),LEN(A1)),"")

I'm curious though why 5 (MIN) doesn't work as the function for AGGREGATE
 
Upvote 0
Ugh! Thanks for catching that Scott! My HTML Maker has been acting weird, it sometimes adds/deletes characters. I normally double check, but I guess I missed it this time. That is the right formula.

And 5 (MIN) doesn't work in AGGREGATE because the function codes less than 14 only work on ranges of data (A1:A10), not arrays {1,2,3}.
 
Upvote 0
In case you might be interested in a fairly succinct user-defined function. To implement ..
1. Right click the sheet name tab and choose "View Code".
2. Copy and Paste the code below into the main right hand pane that opens at step 1.
3. Close the Visual Basic window & test.
4. Your workbook will need to be saved as a macro-enabled workbook (*.xlsm).

Code:
Function Fromlc(s As String) As String
  With CreateObject("VBScript.RegExp")
    .Pattern = "[a-z]"
    If .Test(s) Then Fromlc = Mid(s, .Execute(s)(0).FirstIndex + 1)
  End With
End Function


Excel 2016
MN
103263 7 hh
113502U- 10 htht
12445334 11 tt
1335-409 6
143-355P 7 w 1 vw 1 v
15936423 7
16120-PP 9
177-0565 4
18/34303 9 h 1h 1
19P78062 8
2075566F 4 bb
21/34-PU 8 tt
Remove before lower case
Cell Formulas
RangeFormula
N10=Fromlc(M10)
 
Upvote 0
Hi Guys

The formula works great and Peter's function works great. I think I'll use the function for now.

Thanks Eric, Scott and Peter.

All the best

Graham
 
Upvote 0
With a small change to the pattern, you could just pull the first value from the .Execute

Code:
Function Fromlc(s As String) As String
  With CreateObject("VBScript.RegExp")
    .Pattern = "[a-z].*"
    If .Test(s) Then Fromlc = .Execute(s)(0)
  End With
End Function
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,021
Latest member
Justyna P

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