Hello all,
I am putting together a spread sheet (Open Office Cal.) with phone numbers. I am looking for a way to make them all look the same. Right now they look like
(XXX) XXX-XXXX
XXX-XXX-XXXX
XXX.XXX.XXXX
I would like to make them all look like (XXX) XXX-XXXX.
I did find this tread: https://forum.openoffice.org/en/forum/v ... one+number
But when I put either in the "Numbers" "Format Code" neither code worked. I highlight the row when I do this.
Am I putting it in the wrong spot? Wrong code?
TIA
James
[Solved] Phone number formatting
-
- Posts: 1
- Joined: Mon Sep 26, 2022 6:27 pm
[Solved] Phone number formatting
Last edited by MrProgrammer on Mon Oct 03, 2022 4:21 pm, edited 1 time in total.
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
Reason: Tagged ✓ [Solved] -- MrProgrammer, forum moderator
Open Office 4.1.13/W10
- MrProgrammer
- Moderator
- Posts: 4908
- Joined: Fri Jun 04, 2010 7:57 pm
- Location: Wisconsin, USA
Re: Phone Number Formatting?
Numbers are used for arithmetic, and more generally, for mathematics. You are not going to be doing any math with these values. You won't multiply them, or take square roots, or find their average. You do not have numbers. You have codes. Codes should always be stored in Calc cells as text: Format → Cells → Numbers → Category → Text → OK (and preferably the equivalent operation with a style).Jokersloose wrote: ↑Mon Sep 26, 2022 6:35 pm I am putting together a spread sheet (Open Office Cal.) with phone numbers
Read sections 1. Types of data and 5. Understanding data entry in Ten concepts that every Calc user should know.
Step A: Mark all those cells as textJokersloose wrote: ↑Mon Sep 26, 2022 6:35 pm (XXX) XXX-XXXX
XXX-XXX-XXXX
XXX.XXX.XXXX
I would like to make them all look like (XXX) XXX-XXXX.
Step B: Select the cells, Edit → Find & Replace → More options, select Current selection only and Regular Expressions, Search for [^0-9], Leave the Replace with field empty, Replace All. This removes any punctuation. You are left with 10-character text cells. Now we will use a regular expression to add punctuation.
Step C: Select the cells, Edit → Find & Replace → More options, select Current selection only and Regular expressions, Search for (...)(...)(....), Replace with ($1) $2-$3, Replace All. I recommend unchecking Current selection only and Regular expressions, before clicking Close. This adds desired punctuation.
The following attachment shows the process. All the cells in yellow are formatted as text. Column A shows the original values. Column B shows the values after Step B was performed. Column C shows the values after Step C was performed.
If you need any additional assistance attach a document demonstrating the difficulty (remove confidential information then use Post Reply, not Quick Reply, and don't attach a picture instead of the document itself).
Calc does not recognize values like 123-456-7890 as numbers. Number format codes only apply to numbers.Jokersloose wrote: ↑Mon Sep 26, 2022 6:35 pm But when I put either in the "Numbers" "Format Code" neither code worked.
If this solved your problem please go to your first post use the Edit button and add [Solved] to the start of the subject field. Select the green checkmark icon at the same time.
Mr. Programmer
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).
AOO 4.1.7 Build 9800, MacOS 13.6.3, iMac Intel. The locale for any menus or Calc formulas in my posts is English (USA).