I want to remove everything but “Blabla”.
What command do i use to get the effect as if i did CTRL+H (replace) and told it to replace “,*” with nothing.
I can do it this:
But need to be able to do it using x* etc.
get Morefunc Addon and use:
=REGEX.SUBSTITUTE(A1 , ",(.*)" , "")
Dim x as string x = range("a1").value if cbool(instr(1, x, chr(44))) then _ x = left(x, instr(1, x, chr(44))-1) 'Chr(44) is a comma debug.print x
Addendum: I’d make the function version a little fancier.
Public Function fc_Split_at(sSTR As String, sDELIM As String, Optional iPC = 1) fc_Split_at = Split(sSTR, sDELIM)(iPC - 1) End Function
=fc_Split_at(<original string>, <delimiter>, [optional]<piece to return>)
?fc_Split_at("*Blabla,124814012", ",") *Blabla ?fc_Split_at("*Blabla,124814012", ",", 2) 124814012
Excel’s Find & Replace does allow for wildcard characters.
In your simplified example, if you went to find / replace and typed in:
That would do the trick and remove anything following
Hope that does the trick!!