0

I've always used...

'

...but just found out while reading through a couple of other Q&A's here that there are additionally...

~
\

Why are there multiple escape characters and what are they used for?

Arctiic
  • 1,298

1 Answers1

0

While reviewing my past unanswered questions, I thought I'd come back and take a shot at answering this one myself.

' (when prefixed to direct cell inputs) will convert the output of the cell contents to be displayed As Text. Functionally, this will achieve the equivalent effect as escaping certain characters in terms of visual/typographical output; this does in turn make the cell data harder to work with for formulations or computations in the time since I've written this answer, newer versions of Excel have gained functions, e.g., value(), etc., that improve QoL when working across mixed data types and/or formatting.

\ acts as an escape character for the immediately subsequent character entered, but is particularly used in cell data type formatting or custom formatting rather than for explicit inputs; this enables the user to escape certain characters reserved by Excel for special formatting functions, e.g., the : in cell formatting set as "#:#" normally outputs the resultant data as a Time data type, and would need to be escaped as "#\:#" to mitigate this behavior

~ acts as an escape character for actual cell-input characters, and will behave much in the same way as described above: namely, it will process the immediately subsequent character input as a literal (or for AHK users, think of it as SendRaw).

Hope that explains with more clarity what the respective usage cases are and how they differ from one another!

Related Posts & Acknowledgements:

And my thanks to @DavidPostill for including the actual reference links.

Arctiic
  • 1,298