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.

pop up menu that refers to cells from a table on another sheet

hello,

I would like to inquire if it is possible to set the items in a pop up menu so that it selects from items listed in a specific column on another sheet.


more precisely:

I have a recipe ingredient table and an inventory table on another sheet.

I would like to be able to select from a pop up menu any item from the inventory including later additions to it.


User uploaded file

I would like to select the product here from a list that would directly refer to the table below (on another sheet)


User uploaded file


Thank you very much for the help.

Best regards,


YLWT

numbers 3.1-OTHER, OS X Mavericks (10.9.5)

Posted on Jul 12, 2016 10:32 PM

Reply
10 replies

Mar 7, 2017 2:20 PM in response to Walkermomma66

Walkermomma66 wrote:


Sounds like best to make a chart then print out and then refer carefully to said chart while committing one's self to manual data entry? I can type as fast as I can copy and paste. So why go through all of this trouble if numbers can't support data validation for a category? About ready to go back to excel


Not sure what you are saying here, but it seems unlikely the printing out a chart and entering data manually is a good solution, even if you type quickly.🙂


SG

Jul 13, 2016 7:52 AM in response to YLWT

Hi YLWT,


Though Numbers does not support populating a list by using 'Data Validation' to refer to values in a range of cells, note that you can quickly set up the values in a Pop-Up Menu by listing your values in a column, selecting those cells in the column, then setting their Data Format to Pop-Up Menu. Each of the cells will then contain the full menu. You can then simply copy/paste one of the cells to wherever you need it in your document.


SG

Jul 14, 2016 9:35 AM in response to YLWT

Hi YLWT,


I have been working on a script to address just this issue.

Here is the before

User uploaded file

After the script run:

User uploaded file

The script itself:

--start script

-- This script converts column A in one table (PopupSourceTable in the script) into an alphabetized list of popups. It copies the last cell in that column, then reverts the column to text. You will want to keep that last cell empty. It then refreshes popups in column A of a data table (DataTable in the script) starting with a user defined row.

-- the columns, tables and sheets can all be customized by defining the properties below.



property DataEntrySheet : "popup tables" --name of sheet with popups to be refreshed

property DataEntryTable : "Data Table" --name of table with popups to be refreshed

property DataEntryColumn : "a" --column with popups to be refreshed

set PopStartRow to {}

set pasteRange to {}


property PopValueSheet : "popup tables" --name of sheet with popup source table

property PopValueTable : "customer list" --name of table with popup's values

property PopValueColumn : "b" --name of column with popup's values

set copyRange to {}



tell application "Numbers"

set d to front document

set ps to d'ssheetPopValueSheet

set pt to ps'stablePopValueTable


set s to d'ssheetDataEntrySheet

set t to s'stableDataEntryTable

set tf to t'sfiltered--this records filter setting on data Entry Table


display dialog "Start from row #..." default answer "" with icon 1 -- with icon file "Path:to:my.icon.icns" --a Week # row

set PopStartRow to {text returned of result}


tell pt--convert list to alphabetized popups

set ptRows to count rows

set copyRange to (PopValueColumn & "2:" & name of cellptRows of columnPopValueColumn)

set selection range to rangecopyRange

set selection range'sformat to text


sortbycolumnPopValueColumndirectionascending--alphabetize popups

set selection range'sformat to pop up menu


-- popupsmade

set selection range to cellptRows of columnPopValueColumn of pt

set v to value of cell ptRows of pt

end tell


activateapplication "Numbers"

tell application "System Events" to keystroke "c" using command down


tell pt

set selection range to rangecopyRange

set selection range'sformat to text

end tell

tell t

set filtered to false

set tRows to count rows

set pasteRange to ((name of cellPopStartRow of columnDataEntryColumn) & ":" & (name of celltRows of columnDataEntryColumn))

set selection range to rangepasteRange

tell application "System Events" to keystroke "v" using command down

set filtered to tf

end tell

end tell

--end script


Unfortunately, this script is running inconsistency on my machine. It does everything it is supposed to including selecting the correct range to paste into and then it sometimes pastes into a new table. Help SG! can you see where my script is unclear?


quinn

Jul 14, 2016 2:38 PM in response to t quinn

quinn,


With sheet named 'Popup Tests' data table named 'Data' and table containing customer names in column B named 'Customer List' the script below (based on your ideas) now seems to work reliably here.


SG




set popStartRow to text returned of ¬

(display dialog "Start PopUps in row number..." default answer "" with icon 1) as number


-- data entry area

property dataEntrySheet : "Popup Tests"

property dataEntryTable : "Data"

property dataEntryCol : "A"


-- source of Popup Menu values

property popValSheet : "Popup Tests" --name of sheet

property popValTable : "Customer List" --name of table

property popValCol : "B" --name of column with popup values


tell application "Numbers"

tell front document


-- get popup values

tell sheetpopValSheet

tell tablepopValTable

tell column popValCol to set copyRange ¬

to popValCol & "2:" & last cell's name


sortbycolumnpopValColdirectionascending-- alphabetize

set rangecopyRange'sformat to pop up menu

set selection range to range copyRange's last cell

my guiCopyPaste("c")

set range copyRange's format to text

end tell

end tell



-- paste to data entry table

tell sheetdataEntrySheet

tell tabledataEntryTable

set tf to filtered-- record original filtered status

set filtered to false

tell columndataEntryCol to set pasteRange ¬

to cell popStartRow's name & ":" & last cell's name

set selection range to rangepasteRange

my guiCopyPaste("v")

set filtered to tf-- restore filtered status

end tell

end tell

end tell

end tell

display notification "PopUp Values updated in table '" & dataEntryTable & "' cells " & pasteRange


to guiCopyPaste(aKey)

tell application "Numbers"


activate

repeat until frontmost

end repeat

tell application "System Events" to keystroke aKey using command down

end tell

end guiCopyPaste

Jul 14, 2016 10:54 PM in response to SGIII

i get a prompt message


Can’t make name of last «class NmCl» of «class NMCo» "B" of «class NmTb» "Customer List" of «class NmSh» "Popup Tests" of document 1 of application "Numbers" into type Unicode text.


when i run the script...


I am totally unfamiliar with apple script.

ylwt

Jul 15, 2016 7:57 PM in response to YLWT

Hi YLWT,


Not sure why you would be getting that error message. You should be able to run the script without knowing anything about AppleScript.


Some things to try:


If your region at System Preferences > Language & Region is set to something other than 'United States' try setting it temporarily to 'United States', restarting your computer, and running the script again. If that works then we'll know it has something to do with region settings.


Make sure that 'Script Editor.app' (and, while youre at it 'Automator.app') is checked at System Preferences > Security & Privacy > Privacy > Accessibility.


Also make sure your Numbers document is still open when you run the script.


And, of course, the sheet name and table names have exactly match what is in the script.


SG

pop up menu that refers to cells from a table on another sheet

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