Returning characters before varying character in excel

34 Views Asked by At

I have a column of data in excel that looks like this (credit ratings)...

enter image description here

Is there a way to pull just the letter portion of each rating with a formula in excel?

The ideal outcome would be this the following...

BB
BB
CCC
B
BB
B
CCC
CCC
CCC

1

There are 1 best solutions below

0
Mayukh Bhattacharya On BEST ANSWER

Try something along the line of using the TEXTBEFORE() function:

enter image description here


=IFERROR(TEXTBEFORE(A1:A13,{"-","+","*"}),A1:A13)

Or, Not needed REDUCE(), but posted initially,

=REDUCE(A1:A13,{"+","*","-"},LAMBDA(x,y,SUBSTITUTE(x,y,)))

Or, Just TEXTSPLIT()

=TEXTSPLIT(A1:A13,{"-","+","*"})