You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Format Changing In Numbers

Hi, guys,


I hope my question finds you well.

My default Language and Region for Numbers is Romania. I work with files with the US format (dot instead of comma, different date format and so on). So, I need to go to File→Advanced→Language and Region and switch from Romanian language to English and from Romania to the United States region every time I open a new file. This happens a few times per hour. I found how to change the default language from the System Preferences, but I can't find how to change the default region. I need to make this change every time because I simply don't have the US date format available when the default region is Romania.


Can you please help me?


Thank you and have a great time!


P.S. I also noticed a bug. After I make the language and region switch, I have to select the whole column and then select the right date format twice because after I do it the first time nothing happens.

Posted on Sep 17, 2021 5:44 AM

Reply
Question marked as Top-ranking reply

Posted on Sep 17, 2021 2:42 PM

You can try the following script below:


  1. Copy-paste into Script Editor (in Applications > Utilities)
  2. The first time make sure Script Editor is listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility.
  3. With your machine and Numbers document still set to Romania region select the cells in a copy of the imported table (that have the yyyy.mm.dd date format and 0.000 US formatting for numbers).
  4. Click the <run> button in Script Editor.


If the script does not do what you want, perhaps you can describe the problem and I can try to adapt it.


If it does do what you want and you expect to use it frequently then you can place it in the Script Menu for easy access with one click.


No AppleScript knowledge is needed to use the script, and it should take about a minute to try it out.


SG


The script:


tell front document of application "Numbers"
	tell active sheet
		tell (first table whose class of selection range is range)
			repeat with c in cells of (get selection range)
				set v to formatted value of c as text
				if text 1 thru 2 of v is in {"19", "20"} then -- a date
					set value of c to (my replaceSubstr:"." withSubstr:"-" inString:v)
				else
					set value of c to (my replaceSubstr:"." withSubstr:"," inString:v)
				end if
			end repeat
		end tell
	end tell
end tell

to replaceSubstr:thisStr withSubstr:thatStr inString:aString
	set my text item delimiters to thisStr
	set textItems to text items of aString
	set my text item delimiters to thatStr
	set theText to textItems as text
end replaceSubstr:withSubstr:inString:











4 replies
Question marked as Top-ranking reply

Sep 17, 2021 2:42 PM in response to mihai179

You can try the following script below:


  1. Copy-paste into Script Editor (in Applications > Utilities)
  2. The first time make sure Script Editor is listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility.
  3. With your machine and Numbers document still set to Romania region select the cells in a copy of the imported table (that have the yyyy.mm.dd date format and 0.000 US formatting for numbers).
  4. Click the <run> button in Script Editor.


If the script does not do what you want, perhaps you can describe the problem and I can try to adapt it.


If it does do what you want and you expect to use it frequently then you can place it in the Script Menu for easy access with one click.


No AppleScript knowledge is needed to use the script, and it should take about a minute to try it out.


SG


The script:


tell front document of application "Numbers"
	tell active sheet
		tell (first table whose class of selection range is range)
			repeat with c in cells of (get selection range)
				set v to formatted value of c as text
				if text 1 thru 2 of v is in {"19", "20"} then -- a date
					set value of c to (my replaceSubstr:"." withSubstr:"-" inString:v)
				else
					set value of c to (my replaceSubstr:"." withSubstr:"," inString:v)
				end if
			end repeat
		end tell
	end tell
end tell

to replaceSubstr:thisStr withSubstr:thatStr inString:aString
	set my text item delimiters to thisStr
	set textItems to text items of aString
	set my text item delimiters to thatStr
	set theText to textItems as text
end replaceSubstr:withSubstr:inString:











Sep 17, 2021 11:31 AM in response to SGIII

Hi, SG,


Thank you for the reply.


The main target is to reduce the time I spend doing the same thing over and over again. So, if the solution you proposed will do this with only one click, then it should work just fine.


Here's the data when I open the file (default):


Here's the data after I change the language and region from Romanian to English/US, and after I change the date format to be recognized as "Date" by Numbers and the value format from text to "Number":


Thank you and have a great time!

Sep 17, 2021 9:46 AM in response to mihai179

Would you be open to using a small AppleScript that would allow you to select cells and click a button to change the format so US date format is recognized as such by Numbers even when your regions is set to Romania?


If so please post a screenshot showing what a date when you've opened the file with your default region set to Romania. command-4, select area on screen, release, attach downloaded image from desktop to a new post here, using the 'mountains' icon below the message compose window.


Also an example of what a number looks like when you've opened the file with the default region set to Romania.


SG

Format Changing In Numbers

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