I want to replace the comma separated letters in a cell with the numbers. I've used the=LOOKUP(A1,{"a","b","c","d","e"},{1,2,3,4,5}) function but it's only working for the single letter.
for example: my desired output:
a => 1
I want to replace the comma separated letters in a cell with the numbers. I've used the=LOOKUP(A1,{"a","b","c","d","e"},{1,2,3,4,5}) function but it's only working for the single letter.
for example: my desired output:
a => 1
If you have Excel 2016+ with the TEXTJOIN function, you can use the array formula:
=TEXTJOIN(",",TRUE,CODE(UPPER(FILTERXML("<t><s>"&SUBSTITUTE(A1,",","</s><s>")&"</s></t>","//s")))-64)
Since this is an array formula, you need to "confirm" it by holding down ctrl + shift while hitting enter. If you do this correctly, Excel will place braces {...} around the formula as observed in the formula bar
Algorithm:
"<t><s>"&SUBSTITUTE(A1,",","</s><s>")&"</s></t>"FILTERXML to convert the XML to an array of stringsUPPER to make case insensitiveCODE(…) - 64 to convert to a series of numbers related to the letter)TEXTJOIN to put the result together