Escaping Characters in LibreOffice

From The Document Foundation Wiki
Jump to: navigation, search

Some characters that can be included in a field inside a spread sheet application or a word processor are used by the application itself. Examples might be the double quotation mark(") that marks the beginning or the end of a text-only argument of a function.

To include this kind of characters inside a formula an escape mechanism is needed that tells the application you really do just want to include this character in a formula and did not type in this character since you wanted to end a formula or something. These mechanisms are documented on this wiki page.

Telling LibreOffice Calc that a formula is meant to be text

If you want to fill a spreadsheet cell with text that looks like a formula LibreOffice can be hindered from evaluating this formula by preceeding this formula by a single quotation mark (').

Entering a single quotation mark as the first character of a formula

Since the single quotation mark (') as the first character of a cell has a special meaning If you want to start a cell with a single quotation mark you have to double it ('').

Including a text portion ("string") that contains strange characters into a formula

Just put the text string between two double quotation marks (") and OpenOffice will take the characters you type in as they are without attempting to interpret them.

Entering a double quotation mark inside a formula

Since the double quotation mark is used to tell LibreOffice that a text portion is just meant to be a text portion and LibreOffice should not try to interpret this text a separate mechanism is needed to tell the program that this double quotation mark is meant to be part of the text portion instead. Just doubling the double quotation mark wouldn't be a good idea, though: The resulting character sequence ("") is already used to mark an empty string.

So if you want to use a double quotation mark inside a formula you have to type in four double quotation marks in a row ( """") instead.