Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to encode a string using excel formula?

I want to encode a string with the rule below:

If I have a string like ABCDEAC, I want to encode it like 1234513.
For a string like CDABAEB. I want to encode it like "1234354"

The rule to encode is: With the first character of string always assigned 1 and will increase gradually by position.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

Can an Excel formula (no VBA) be used to resolve it?

Many thanks for considering my request.

Nothing. I am just thinking.

>Solution :

If you are an user of Microsoft-365 then could use-

=LET(
x,MID(A1,SEQUENCE(LEN(A1)),1),
y,UNIQUE(x),
CONCAT(XLOOKUP(x,y,SEQUENCE(ROWS(y))))
)

We can simplify the formula using XMATCH() instead of XLOOKUP().

=LET(
x,MID(A1,SEQUENCE(LEN(A1)),1),
y,UNIQUE(x),
CONCAT(XMATCH(x,y))
)

enter image description here

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading