NewbieXXL
NewbieXXL

Reputation: 175

How can I add quotation marks to a libreoffice calc cell text?

In libreoffice calc I have a column with thousand words. Each word I need to put into quotation marks.

Example (A1 and A2 are cells)

start word (A1): car
end word (A2): "car"

Normally, I can reference cells and add new text with quotes.

Example

= A1 & " wash" A2: car wash

But how do I get quotation marks as part of the text? Example

"car" wash

Upvotes: 6

Views: 13409

Answers (2)

sebix
sebix

Reputation: 3240

It also works with CONCAT and escaping the quote sign:

=CONCAT("""", A1, """ wash")

To escape ", put another " in front of it, so "" results in one double quote ". Putting this in a string results in """"" for one double quote.

Using double quotation marks in formulas

Upvotes: 0

tohuwawohu
tohuwawohu

Reputation: 13618

One way to add quotes: use the CHAR() function together with the correct decimal ASCII code. CHAR(34) should return double quotes. You can insert the CHAR() function directly into a concat statement:

= CHAR(34) & A1 & CHAR(34) & " wash"

should combine the content of A1, nested into double quotes, and append " wash".

To modify the source data itself (in your example: no second column, modify the source column), you could use a search / replace with regular expressions. To do so:

  1. Select the column containing the data to modify
  2. select Menu "Edit" -> "Find & Replace..."
  3. Enter ^(.*)$ as search text (matches the whole cell content) and "$1" as replace text (returns the complete search match, embedded in quotes): enter image description here
  4. Hit Replace or Replace all to execute the search/replace run.

Upvotes: 15

Related Questions