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.

How do I get cells in one column to autofill based on selection from pop up menu in another column?

What I am trying to do is create a milage record for work travel. Column A would be dates. Column B would have pop-up menu with a selection of specific locations I travel to. What I want is then for column C to autofill with the milage distance for a selected location from the pop up menu in column B.

Does that make sense? Can anyone advise how to do this?

Thanks

Ed


MacBook Air 13″, macOS 11.4

Posted on Jun 13, 2021 3:54 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 13, 2021 7:21 AM

You can make a destination table like this:



NOTE: Make sure to name this table "Distance". Double click the text "Table 1" and type "Distance"



Now create the pop-up from column A:


then choose "Pop-Up Menu" from the Data Formatter menu:



Cell A2, copy

create a new table like this,



Now select cell B2 and paste. select the pop-up menu you just pasted and choose the "NONE" option


Now select that same pop-up, copy

Now select the cells B2 thru the last cell in column C, paste


When you travel, select the start location and destination.


Now let's enter the formula to perform the lookup. Select cell D2 in table "Table 2"



Select cell D2, then type (or copy and paste from here) the formula:


=IF(B2=C2, "", OFFSET(Distance::$A$1,MAX(MATCH(C2, Distance::$1:$1,0)−1, MATCH(B2, Distance::A,0)−1),MIN(MATCH(C2, Distance::$1:$1,0)−1, MATCH(B2, Distance::A,0)−1)))



shorthand for this is:

D2=IF(B2=C2, "", OFFSET(Distance::$A$1,MAX(MATCH(C2, Distance::$1:$1,0)−1, MATCH(B2, Distance::A,0)−1),MIN(MATCH(C2, Distance::$1:$1,0)−1, MATCH(B2, Distance::A,0)−1)))


select cell D2, copy

select cells D2 thru the end of column D, paste




Similar questions

6 replies
Question marked as Top-ranking reply

Jun 13, 2021 7:21 AM in response to MrEd_

You can make a destination table like this:



NOTE: Make sure to name this table "Distance". Double click the text "Table 1" and type "Distance"



Now create the pop-up from column A:


then choose "Pop-Up Menu" from the Data Formatter menu:



Cell A2, copy

create a new table like this,



Now select cell B2 and paste. select the pop-up menu you just pasted and choose the "NONE" option


Now select that same pop-up, copy

Now select the cells B2 thru the last cell in column C, paste


When you travel, select the start location and destination.


Now let's enter the formula to perform the lookup. Select cell D2 in table "Table 2"



Select cell D2, then type (or copy and paste from here) the formula:


=IF(B2=C2, "", OFFSET(Distance::$A$1,MAX(MATCH(C2, Distance::$1:$1,0)−1, MATCH(B2, Distance::A,0)−1),MIN(MATCH(C2, Distance::$1:$1,0)−1, MATCH(B2, Distance::A,0)−1)))



shorthand for this is:

D2=IF(B2=C2, "", OFFSET(Distance::$A$1,MAX(MATCH(C2, Distance::$1:$1,0)−1, MATCH(B2, Distance::A,0)−1),MIN(MATCH(C2, Distance::$1:$1,0)−1, MATCH(B2, Distance::A,0)−1)))


select cell D2, copy

select cells D2 thru the end of column D, paste




Jun 15, 2021 1:46 AM in response to Wayne Contello

It took me a while to get my head around what was proposed - both seemed viable, but after more searching I came across VLOOKUP formulas and had a go with that which was simple for me to understand and create. So, in Column A I placed all the locations I travel to. In Column B I placed their respective distances.

In Column C each cell had a pop up menu with the different location options. In Column D I used in each cell a VLOOKUP formula as follows (VLOOKUP C1, A1:B31, 2, exact match).

Jun 15, 2021 5:57 AM in response to MrEd_

MrEd_ wrote:

It took me a while to get my head around what was proposed - both seemed viable, but after more searching I came across VLOOKUP formulas and had a go with that which was simple for me to understand and create.


The XLOOKUP used above is a more modern and more flexible version of VLOOKUP. One of its many advantages over VLOOKUP is that it allows you easily to specify what to specify what to display if it doesn't find an exact match. Highly recommend trying it out. It's actually easier to use than VLOOKUP.


Also, in Numbers it is often better to separate data into separate tables and to use Footer Rows for formulas. That way you can just use column letters where you current have $A$1:$B$3.



SG

How do I get cells in one column to autofill based on selection from pop up menu in another column?

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