Numbers: Function that returns many reliable answers.

Hello, dear Community. I've looked for this answer on the forum, but there was nothing found. If this topic was solved some time ago, please give me the link.

Pretty simple question. Xlookup works only for first found reliable answer, but cannot output many reliable answers. (Table 2, B2 is an example.) Please help.

Mac mini, macOS 12.4

Posted on Jun 15, 2022 8:09 AM

Reply
Question marked as Top-ranking reply

Posted on Jun 15, 2022 10:58 AM

There are a number of different solutions. Here is one. It makes a list of the names in a column. It will not put commas between them. That would be an additional step requiring concatenation.



Formula in Table 1 C2 =B2&"-"&COUNTIF(B$2:B2,B2)

Fill down to complete the column.

Note that this formula is NOT sort-safe. There is an annoying and longstanding bug in Numbers that messes up the cell references in the formula if the table is sorted. I hope one day they see fit to fix it. The sort-safe version of the formula is more complicated.


Formula in Table 2 B2 =XLOOKUP(B$1&"-"&ROW()−1,Table 1::$C,Table 1::$A,"",0)

Fill down and across to complete the table.


A few other ideas are in this recent thread: Index and Match with arrays - Apple Community

Other ideas are scattered in the forum over the past many years. I never have much luck searching but a search for "multiple matches" or "multiple lookups" or "multiple results" or something along those lines might yield additional ways to do it.

2 replies
Question marked as Top-ranking reply

Jun 15, 2022 10:58 AM in response to Vovchanok

There are a number of different solutions. Here is one. It makes a list of the names in a column. It will not put commas between them. That would be an additional step requiring concatenation.



Formula in Table 1 C2 =B2&"-"&COUNTIF(B$2:B2,B2)

Fill down to complete the column.

Note that this formula is NOT sort-safe. There is an annoying and longstanding bug in Numbers that messes up the cell references in the formula if the table is sorted. I hope one day they see fit to fix it. The sort-safe version of the formula is more complicated.


Formula in Table 2 B2 =XLOOKUP(B$1&"-"&ROW()−1,Table 1::$C,Table 1::$A,"",0)

Fill down and across to complete the table.


A few other ideas are in this recent thread: Index and Match with arrays - Apple Community

Other ideas are scattered in the forum over the past many years. I never have much luck searching but a search for "multiple matches" or "multiple lookups" or "multiple results" or something along those lines might yield additional ways to do it.

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.

Numbers: Function that returns many reliable answers.

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