Forum Discussion
a_heb2275
Oct 14, 2021Copper Contributor
Convert letters to different letters in a string
Hello, I was wondering if someone could help me and my achy brain? I am looking to have an input and output column, the input being normal letters a-z (A2 to A28), and the output being letters in...
- Oct 15, 2021
See the attached sample workbook. It uses a custom VBA function, so you'll have to allow macros.
PeterBartholomew1
Oct 15, 2021Silver Contributor
Just for play, this is a 365 version of the Caesar cypher (it cycles letters by a shift value)
= LET(
split, MID(text, SEQUENCE(LEN(text)),1),
noCaps, MOD(CODE(split),32),
code, 97+MOD(noCaps+shift-1,26),
CONCAT(CHAR(IF(noCaps, code,160))))
Naturally, I wouldn't leave it there, so wrapping in within a Lambda function, 'ENCODEλ',
= LAMBDA(text,shift,
LET(
split, MID(text, SEQUENCE(LEN(text)),1),
noCaps, MOD(CODE(split),32),
code, 97+MOD(noCaps+shift-1,26),
CONCAT(CHAR(IF(noCaps, code,160))))
)
the worksheet function reduces to
= ENCODEλ(text,shift)
and to decode to result
= ENCODEλ(encodedText,-shift)
Sometimes I am sure people think I am exaggerating when claim that future Excel bears very little resemblance to traditional spreadsheets! What do you think?