Want to highlight a helpful answer? Upvote!

Did someone help you, or did an answer or User Tip resolve your issue? Upvote by selecting the upvote arrow. Your feedback helps others! Learn more about when to upvote >

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

How to insert value based on pop-up menu choice?

Simple question. I have created a pop-up menu with three choices. Cell B3. Based on the choice I need to insert a number value in cell B4. For example:


IF (B3="item1", $25)

IF (B3="item2", $45)

IF (B3="item3", $60)


How to do this properly so based on my B3 pop-up choices I would get correct values in B4?

MacBook Pro with Retina display, iOS 10.0.2

Posted on Oct 12, 2016 9:29 PM

Reply
8 replies

Oct 13, 2016 12:18 PM in response to plemax

create a second table which is a price list (name the table "Price List" as shown below, on the right):

User uploaded file


In the table on the left enter the item (selected from a pop up menu that contains "Item 1", "Item 2", etc)

C1=IFERROR(VLOOKUP(B1, Price List::A:B, 2, 0), "")


this is shorthand for... select cell C1, then type (or copy and paste from here) the fomrula

=IFERROR(VLOOKUP(B1, Price List::A:B, 2, 0), "")


select cell C1, copy

select column C, paste


to change the price of "Item 3", alter the value in column B of the corresponding row for "Item 3"

Oct 13, 2016 1:44 PM in response to plemax

the syntax for vlookup() is available in the online help by typing an "=" in any cell then you can use the function browser to location details about the function:


the syntax for vlookup() is:

VLOOKUP(search-for, columns-range, return-column, close-match)

so the "2, 0" corresponds to the

return-column is 2 which means return column 2 (see image below showing column 1 and 2 in the lookup table)

close-match is 0 means find an exact match


User uploaded file

Oct 13, 2016 3:37 PM in response to plemax

Hi plemax,


EDIT: Had this open while on another topic, and neglected to check for updates when I got to it and composed the response below. Will leave it as is, as a variation on Wayne's solution.

B


What you need is a lookup table, containing the price list, and pop-up menus in column A of your main table (Table 1) containing all of the item names on the price list.


User uploaded file

Table 1 has one formula, entered in B2, then filled down to the bottom of column 2:


B2: =IF(ISBLANK(A2),"",LOOKUP(A2,Price list::A,Price list::B))


Cell A2 is set to "None". This menu item is added to a pop-up menu when you set the menu in the cell format inpector > Pop-up menu to "Start with Blank".


If you want the numbers on Table 1 to display as currency, set the format for those cells to Currency, with two decimal places.

User uploaded file

Regards,

Barry

Oct 13, 2016 4:59 PM in response to Barry

This also works! Thank you guys. My next question then, can I connect a database to populate data from another source or it has to be on the same sheet? You see where it can be problematic if I use two table and position them on the same sheet? I guess I can create a new sheet and refer to data from there, but it would be awesome if I can use protected database and use a spreadsheet as a user interface. Is it possible with Numbers?

Oct 13, 2016 5:47 PM in response to plemax

Hi plemax,


Numbers can't reference cells (fields) on external documents, whether these are Numbers docs or others.


If your DB is a single table, you can place it on a separate Sheet in the same document and retrieve infomation in basically the same manner as you are doing with the two column 'database' containing the price information in Wayne's solution (and mine) above.


While you can't protect that table from intentional damage or alteration, you can lessen the danger of accidental damage by having it on a separate sheet and locking it. A locked table can still be read, but can't be moved or written to without first unlocking it.


Regards,

Barry

How to insert value based on pop-up menu choice?

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