Selecting a subset from an array

I'm trying to build a spreadsheet to help schedule weekly golf foursomes. There are 19 guys, but only 4 tee times, so 3 of the 19 guys will sit out as "Spares" each week. I've built a template sheet (shown here) with all the guys and the play dates, and I've pre-filled cells with 1's to indicate the 3 guys who will be sitting out for each week.


As you can see, the date May 1 is highlighted...that's the play date. What I need to do is select the 16 names in Column I which don't have a 1 in the column that designates the play date...in this case Column K. Next week (May 8) I'd want the 16 names of the guys who don't have a 1 in Column L. I want the 16 names in a single column with no blank cells, i.e. just 16 cells that I can copy to another sheet.


I haven't been able to figure out a relatively simple way of doing this, if there even is one. I'd appreciate any suggestions.

MacBook Pro 13″

Posted on Mar 10, 2025 7:53 PM

Reply
Question marked as Top-ranking reply

Posted on Mar 10, 2025 11:08 PM

I've spent a few hours looking for a solution, but since Numbers does not support array functions, there isn't a great one. It requires you to sort each week manually, but that only takes about two seconds.


Here is my solution:


Create a second table and copy each date from your original table into the header row of the new table. In A2, add the formula

=IF(ISBLANK(Play dates::J2),Play dates::$I2)

(I've called the first table "Play dates" so change this to it's actual name)


Autofill the entire table with this formula, then each week Sort Ascending in the column you need by right-clicking on the column letter or by opening the menu from the little down arrow.


It should look like this:


Let me know if this is what you were looking for!

5 replies
Question marked as Top-ranking reply

Mar 10, 2025 11:08 PM in response to RodMan49

I've spent a few hours looking for a solution, but since Numbers does not support array functions, there isn't a great one. It requires you to sort each week manually, but that only takes about two seconds.


Here is my solution:


Create a second table and copy each date from your original table into the header row of the new table. In A2, add the formula

=IF(ISBLANK(Play dates::J2),Play dates::$I2)

(I've called the first table "Play dates" so change this to it's actual name)


Autofill the entire table with this formula, then each week Sort Ascending in the column you need by right-clicking on the column letter or by opening the menu from the little down arrow.


It should look like this:


Let me know if this is what you were looking for!

Mar 11, 2025 12:00 AM in response to RodMan49

Is there a reason you have this Excel-like area of cells in a bigger grid of cells?


In Numbers you would typically put this in a table of its own, with the names in column A and dates across the top in a Header Row.


If you do that, you will find it is a simple matter to:


1) filter on a column (to hide the rows with 1s) in turn


2) copy-paste the names from column A into a column in a destination table.


3) Undo that filter, go on to the next column, and repeat.


This is not fully automated but would probably take at most two or three minutes.


SG




Filter data in Numbers on Mac - Apple Support


Mar 11, 2025 1:41 AM in response to RodMan49

I can recommend a solution that I learned right in this community.

It is a bit laborious at first, but it has the advantage that, once set, it fills the columns automatically.

Follow my screenshot that I reduced for convenience



Add two columns after each date and as a header to the second column you add copy the date so that the date of B1 is = to D1

In C2 put this formula and then drag it throughout the column


=IF(B2=0;MAX(C$1:C1)+1;”")


With this formula you transform the names of the participants into a numerical list, leaving out those who do not play.

In D2 put this other formula with which you match the names to the numerical list obtaining the final list already ordered


=IF(ROW()−1>MAX(C);””;INDEX($A;MATCH(ROW()−1;C;0)))


Basically, this formula also acts as a filter.

This too should be dragged throughout the column.

You do the same thing in the two columns you add to each column with the date, where you just need to copy and paste the formula.

At the end hide all the columns with the numbers and get your calendar, as you see from this second Screenshot.

Mar 11, 2025 6:06 AM in response to Dubbia

Dubbia...you are a genius!! That's exactly the solution I need...can't say thank you enough. The other proposed solutions would work, but the buddy I'm doing this for is not tech savvy so he'd probably make mistakes doing the manipulations. Dubbia...thanks very much for putting some effort into this. BTW...there's one un-needed right bracket at the end of your second formula, but I figured that out quickly. Cheers!

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Selecting a subset from an array

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