A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data.
Here is a function that obfuscates a range of cells. To use, set SourceArray (the first parameter in the first LET function) to the range of cells to obfuscate. The function returns an array of obfuscated values the same size as the source array. Alpha characters are converted to random alpha characters, numeric characters are converted to random numeric characters, and all punctuation characters are left untouched. Alpha character casing is retained. If used in a table, SourceArray must a single cell or a #SPILL! error will occur.
=LET(
SourceArray, B2:B4,
UpperVowels, "AEIOU",
LowerVowels, LOWER(UpperVowels),
UpperConsonants, "BCDFGHJKLMNPQRSTVWXYZ",
LowerConsonants, LOWER(UpperConsonants),
Numbers, "0123456789",
Result, MAKEARRAY(ROWS(SourceArray), 1, LAMBDA(Row,Column,
LET(
SourceValue, INDEX(SourceArray, Row),
TEXTJOIN(
"",
FALSE,
MAKEARRAY(1, LEN(SourceValue), LAMBDA(Row,Column,
LET(
Character, MID(SourceValue, Column, 1),
SWITCH(TRUE,
NOT(ISERROR(FIND(Character, UpperVowels))), MID(UpperVowels, RANDBETWEEN(1, LEN(UpperVowels)), 1),
NOT(ISERROR(FIND(Character, LowerVowels))), MID(LowerVowels, RANDBETWEEN(1, LEN(LowerVowels)), 1),
NOT(ISERROR(FIND(Character, UpperConsonants))), MID(UpperConsonants, RANDBETWEEN(1, LEN(UpperConsonants)), 1),
NOT(ISERROR(FIND(Character, LowerConsonants))), MID(LowerConsonants, RANDBETWEEN(1, LEN(LowerConsonants)), 1),
NOT(ISERROR(FIND(Character, Numbers))), MID(Numbers, RANDBETWEEN(1, LEN(Numbers)), 1),
Character
)
)
))
)
)
)),
IFERROR(VALUE(Result), Result)
)
An example:
| Before | After |
|---|---|
| Now is the time. | Hed ob mfu mico. |
| San Francisco, CA 95000 | Lef Byiddonfa, MI 61820 |
| $123,456.00 | $193,035.00 |
Kevin