Frequently asked questions - Calc

From The Document Foundation Wiki
< Faq‎ | Calc
Jump to: navigation, search

How to convert number text to numeric data

It can happen that data pasted from the clipboard or imported from CSV or entered into a cell that was already formatted as Text is of type Text although it visually looks like a number or date, and text can't be used in calculations. The cell content in this case in the Input Line is preceded with a leading ' apostrophe which is not part of the cell content, to indicate that the content could be interpreted as number if it wasn't text. To convert such number text to numeric data do the following, which assumes that the text actually can be converted, i.e. uses the separators (decimal, date, ...) of your locale.

  • mark the cell range containing the data to convert
  • press Ctrl+M or right click on the marked range to get the context menu and select Clear Direct Formatting
  • press Ctrl+H or choose Edit -> Find & Replace from the menu
    • enter Find: .+
    • enter Replace: $0
    • under Other options activate
      • Current selection only
      • Regular expressions
    • hit Replace All

This enters the cell content anew, basically as if it was entered from keyboard, and detects numeric/date/time input.

If you need such functionality more often or to convert data with separators differing from your locale, install the CT2N - Convert Text To Number (and dates) extension.

Notes: