In Numbers, how can I remove hyphens from UPC numbers?

I have a long list of UPC codes in this format: 123-456-789-012. I need them to appear without the hyphens, like this: 123456789012. I have tried Inspector/ Cell Format/ Custom Format but can't seem to get my custom format to apply to the selected cells. I have the cells highlighted, I press Okay, but nothing happens. I am able to successfully apply custom formats to other columns no problem. It seems the hyphens are causing the problem. Endless online searching and browsing of the help menu and manuals is still leaving me stumped. Anyone know the simple way to do this? Many thanks!

iWork Numbers-OTHER

Posted on Apr 15, 2012 10:18 AM

Reply
6 replies

Apr 15, 2012 10:28 AM in response to Sweetmona

use the "Find/Replace" dialog which you can open by typing the key combination <command>+f, then clciking the "Find & Replace..." button:

User uploaded file



You can then enter a "-" in the "Find" text box, and leave the "Replace" text box empty:

User uploaded file


I added (based on a suggestion from Yvan) the "Find/Replace" button to my tool bar by using the menu item "View > Customize Toolbar..."

Apr 15, 2012 11:23 AM in response to Sweetmona

Hi Mona,


Custom formatting can be used to display something Numbers interprets as a "number" as a combination of number(s) and text.


But Numbers interprets an entry (as opposed to a display) that contains both numbers and text as a text string, and custom formatting can't be used to display only the numeric characters in that string. You'll need Find and Replace, as already suggested, or a formula, to make that conversion.


One difficulty with Find/Replace is that it is All or One-at-a-time.


Clicking the Replace and Find button, as suggested by Wayne, can get tedious,if you have a large number of replacements to do (you have three for each entry). Clicking Replace All, as suggested by Jerry, does exactly that; great if the only hyphens in your document are the ones you want to replace, not so great if there are hyphens that are not part of the UPC codes, and that you want to keep.


Here's an alternate method that requires inserting a temporary column to do the conversion, but can be restricted to apply only to the column containing the UPC list.


In the table below, the original UPCs are in column B.

Column C has been added, and contains the formula shown above the table (and copied below), filled down through the rest of the column.


User uploaded file


=SUBSTITUTE(B,"-","",)


After the conversion is done, Select and Copy all of the cells that contain trimmed UPCs (C2-C10 in the example), then click on the cell containing the first UPC in its original form and go Edit (menu) > Paste Values.

Then select and delete column C.


Regards,

Barry

Apr 15, 2012 11:33 AM in response to Sweetmona

Another way to limit the Find and Replace zone and still do it quickly, without writing any formulas, is to Insert > Sheet to create a separate working area. Delete the default table in the new sheet just to keep things tidy.


Back in the original sheet Copy the column with the codes, click on the new sheet and Paste.

Choose Find In: Current Sheet Only

Click Replace All


Copy the cleaned column and Paste it back to the original table.


Jerry

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

In Numbers, how can I remove hyphens from UPC numbers?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.