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

how do I insert new table between several existing tables

I have a Numbers sheet which contains several tables each represents one stock holding. I prefer to keep the tables in alphabetical order by stock symbol. The tables are organized vertically with about 1/2 inch between tables.


how do I add a new table between existing tables to maintain the alphabetical order?


Bill



Posted on Feb 8, 2019 3:58 AM

Reply
Question marked as Best answer

Hi bill,


Try this:


Add the new table.

Drag it to a location just below the table that should precede it.

Scroll to the last table.

Drag it down to open enough space for the new table.


With the bottom table selected, press command-A to select all (tables).


Make two trips to the Arrange menu:

Arrange > Align > Left

Arrange > Distribute > Vertically


Can be a bit fiddly.


Regards,

Barry

Posted on Feb 9, 2019 9:49 PM

2 replies
Question marked as Helpful

Feb 10, 2019 2:13 AM in response to Bill3

There is probably a way to script the arrangement of the tables.


But if you're keeping like data in all the tables, why not just combine them into one table> That way your data will be easy to sort alphabetically. And whenever you want to see a particular stock just apply a filter. Or use Categories (Organize menu) to let Numbers organize them for you.


SG

8 replies
Question marked as Best answer

Feb 9, 2019 9:49 PM in response to Bill3

Hi bill,


Try this:


Add the new table.

Drag it to a location just below the table that should precede it.

Scroll to the last table.

Drag it down to open enough space for the new table.


With the bottom table selected, press command-A to select all (tables).


Make two trips to the Arrange menu:

Arrange > Align > Left

Arrange > Distribute > Vertically


Can be a bit fiddly.


Regards,

Barry

Question marked as Helpful

Feb 10, 2019 2:13 AM in response to Bill3

There is probably a way to script the arrangement of the tables.


But if you're keeping like data in all the tables, why not just combine them into one table> That way your data will be easy to sort alphabetically. And whenever you want to see a particular stock just apply a filter. Or use Categories (Organize menu) to let Numbers organize them for you.


SG

Feb 11, 2019 6:12 AM in response to Bill3

If you haven't tried the one-table approach (which I recommend) here's an AppleScript that will do what you describe with two clicks. It assumes you want to sort by table names (which you've presumably set to stock symbols or company names.)


  1. Copy-paste the script below into Script Editor (in Applications > Utilities)
  2. Make sure Script Editor.app and Numbers.app are listed and checked at System Preferences > Security & Privacy > Privacy > Accessibility.


Thereafter,


  1. Click somewhere on the sheet where you have the tables.
  2. Click the triangle 'run' button in Script Editor.


If you do this a lot you can place the script in the Script Menu so it becomes a menu pick.


SG


set firstTableXPos to 0 -- 0pt from left -- change as needed
set firstTableYPos to 30 -- 30pt from top -- change as needed
set vertSpacing to 55 -- space between tables -- change as needed

tell application "Numbers"
	tell front document's active sheet
		set tblNamList to my sortList(tables's name)
		set yPos to firstTableYPos
		repeat with n in tblNamList
			tell table n
				set tblHeight to its height
				set tblPos to {firstTableXPos, yPos}
				set its position to tblPos
				set yPos to yPos + tblHeight + vertSpacing
			end tell
		end repeat
		
	end tell
end tell

to sortList(theList)
	set theIndexList to {}
	set theSortedList to {}
	repeat (length of theList) times
		set theLowItem to ""
		repeat with a from 1 to (length of theList)
			if a is not in theIndexList then
				set theCurrentItem to item a of theList as text
				if theLowItem is "" then
					set theLowItem to theCurrentItem
					set theLowItemIndex to a
				else if theCurrentItem comes before theLowItem then
					set theLowItem to theCurrentItem
					set theLowItemIndex to a
				end if
			end if
		end repeat
		set end of theSortedList to theLowItem
		set end of theIndexList to theLowItemIndex
	end repeat
	return theSortedList
end sortList

Feb 11, 2019 8:07 AM in response to SGIII

Thanks for your effort. As a long time EXCEL USER, I STARTED MOVING TO NUMBERS BECAUSE OF BETTER stock quote service (oops didn't mean all caps).


Looking back and getting your opinion I should have used one table for stock purchases since each table is identical. Live and learn.


Regards,

Bill

how do I insert new table between several existing tables

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