ROT13 is a simple letter substitution cipher that replaces each letter with the 13th letter after it in the alphabet. Here's the Excel function you can use to ROT13 the text in cell A1 and display the result in cell B1:
LET(original, A1, ...) assigns the value of A1 to a variable named original for easier reference.
MID(original, SEQUENCE(LEN(original)), 1) splits the text in A1 into individual characters. SEQUENCE(LEN(original)) generates an array of numbers from 1 to the length of the text, and MID extracts each character at those positions.
CODE(chars) converts each character to its ASCII code (e.g., "A" becomes 65, "a" becomes 97).
rot13codes applies the ROT13 transformation:
For letters A-M (65-77) and a-m (97-109), add 13 to the code.
For letters N-Z (78-90) and n-z (110-122), subtract 13 from the code.
For non-letters (e.g., spaces, punctuation), leave the code unchanged.
CHAR(rot13codes) converts the transformed ASCII codes back to characters.
TEXTJOIN("", TRUE, rot13chars) concatenates the ROT13'd characters into a single string. The TRUE argument ignores empty values (none in this case).
Example usage:
A1
B1 (formula result)
Hello, World!
Uryyb, Jbeyq!
Excel is fun!
Rkpry vf sha!
Enter the formula in B1, and whenever you change the text in A1, the ROT13'd result will update automatically in B1.
Notes:
This formula works in Excel 2019 and later versions, which support the LET, SEQUENCE, and TEXTJOIN functions. If you're using an older Excel version, you might need to use VBA or an alternative approach.
The formula is case-sensitive and preserves the original casing.