NUMBERS syntax error simply because a number in a cell has COMMA

I love NUMBERS but this is one thing that has been bugging me for sometime now.


My sheet is formatted in a way that numbers in a cell will have the "dot" for cents and "comma" for thousand separators, just like this cell below:


But when I copy this exact same number from one cell and insert it in another cell (like this):


it doesnt work, it gives me a "syntax error" like this:



So whenever I'm copying a number from a cell and pasting it in another cell I have first to delete the thousand separators commas in the number so it can work. And this is annoying if you have to copy and paste several numbers in a sheet like I usually have to do.


Can somebody please help me fix this? Thanks a lot!!


iPhone 15 Pro Max, iOS 17

Posted on May 31, 2024 12:43 PM

Reply
Question marked as Top-ranking reply

Posted on Jun 4, 2024 2:14 PM

Formulas do not allow commas in numbers, probably because commas have a special purpose in formulas: to separate the parameters in functions. While the +-*/ operators could conceivably figure out commas in numbers, it would be inconsistent use of commas. You could end up with something like this mess of a syntax error

=IF(A2=1,234.56+5,432.10, TRUE, FALSE)


Use Paste and Match Style for pasting in a single number without affecting the cell formatting. I redefined the keyboard shortcut on mine to Command Shift V. I don't recall the original shortcut but I believe it involved an extra finger or two and maybe a toe. It is common to a lot of Apple apps so redefine it for "all applications" if you are going to redefine. System Preferences->Keyboard->Keyboard Shortcuts->App Shortcuts or wherever it is in more recent MacOS's than I have. The menu item needs to be typed in EXACTLY as it appears in the menu.


If you need to do what you showed in your last screenshot where you are pasting several numbers into the same cell, a "Service" (Quick Action) can be created in the Automator app that will remove commas from whatever has been copied onto the clipboard. You can then assign a keyboard shortcut to it for ease of use. I suppose this can all be done in the new "Shortcuts" app, too, but I have been unsuccessful assigning a keyboard shortcut to one.



	set TempTID to AppleScript's text item delimiters
	set AppleScript's text item delimiters to ","
	set theText to the clipboard as string
	set theTextItems to every text item of theText
	set AppleScript's text item delimiters to ""
	set theText to theTextItems as string
	set AppleScript's text item delimiters to TempTID
	set the clipboard to theText



Name it something like 'Remove Commas From Clipboard Text" or something else that makes sense to you. It will show up under the Numbers menu as a Service. If you used "in any application" (like I did) it will show up in other apps, too, like Safari, Pages, etc.. Use "in Numbers" if you want it to be only in Numbers.


Assign a keyboard shortcut to it just like you can do with any other menu item.


Copy your number (Command C), use your keyboard shortcut to remove the comma(s), Paste (Command V)


Note: If you copy a column of cells in Numbers, this script will add an extra cell above and below when pasted back into Numbers. I have no idea how to make it stop that other than rewriting it specifically for Numbers to delete those artifacts. But you're not using it for that purpose anyway.


6 replies
Question marked as Top-ranking reply

Jun 4, 2024 2:14 PM in response to danielbottrel

Formulas do not allow commas in numbers, probably because commas have a special purpose in formulas: to separate the parameters in functions. While the +-*/ operators could conceivably figure out commas in numbers, it would be inconsistent use of commas. You could end up with something like this mess of a syntax error

=IF(A2=1,234.56+5,432.10, TRUE, FALSE)


Use Paste and Match Style for pasting in a single number without affecting the cell formatting. I redefined the keyboard shortcut on mine to Command Shift V. I don't recall the original shortcut but I believe it involved an extra finger or two and maybe a toe. It is common to a lot of Apple apps so redefine it for "all applications" if you are going to redefine. System Preferences->Keyboard->Keyboard Shortcuts->App Shortcuts or wherever it is in more recent MacOS's than I have. The menu item needs to be typed in EXACTLY as it appears in the menu.


If you need to do what you showed in your last screenshot where you are pasting several numbers into the same cell, a "Service" (Quick Action) can be created in the Automator app that will remove commas from whatever has been copied onto the clipboard. You can then assign a keyboard shortcut to it for ease of use. I suppose this can all be done in the new "Shortcuts" app, too, but I have been unsuccessful assigning a keyboard shortcut to one.



	set TempTID to AppleScript's text item delimiters
	set AppleScript's text item delimiters to ","
	set theText to the clipboard as string
	set theTextItems to every text item of theText
	set AppleScript's text item delimiters to ""
	set theText to theTextItems as string
	set AppleScript's text item delimiters to TempTID
	set the clipboard to theText



Name it something like 'Remove Commas From Clipboard Text" or something else that makes sense to you. It will show up under the Numbers menu as a Service. If you used "in any application" (like I did) it will show up in other apps, too, like Safari, Pages, etc.. Use "in Numbers" if you want it to be only in Numbers.


Assign a keyboard shortcut to it just like you can do with any other menu item.


Copy your number (Command C), use your keyboard shortcut to remove the comma(s), Paste (Command V)


Note: If you copy a column of cells in Numbers, this script will add an extra cell above and below when pasted back into Numbers. I have no idea how to make it stop that other than rewriting it specifically for Numbers to delete those artifacts. But you're not using it for that purpose anyway.


Jun 4, 2024 12:28 PM in response to Niel

The thing is... if I do this, it will unconfigure all my layout settings (font size, font type, aligments, etc.) for that cell. But mainly, besides this, the real problem is that I cannot copy and paste several numbers from other sources... for example: I'm copying some numbers from my bank statement and pasting them on my numbers sheet... it wont work:



I'll have to delete each comma before I press enter...


It doesnt make sense... NUMBERS do recognize these numbers with commas but it simply doesnt accept them as they are if they are copied to a cell...

Jun 4, 2024 12:29 PM in response to danielbottrel

Iif I don't use the Insert function or define it as a formula; and instead, just paste the cell contents in., it will unconfigure all my layout settings (font size, font type, aligments, etc.) for that cell. But mainly, besides this, the real problem is that I cannot copy and paste several numbers from other sources... for example: I'm copying some numbers from my bank statement and pasting them on my numbers sheet... it wont work:




I'll have to delete each comma before I press enter...


It doesnt make sense... NUMBERS do recognize these numbers with commas but it simply doesnt accept them as they are if they are copied to a cell...

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.

NUMBERS syntax error simply because a number in a cell has COMMA

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