How to display multiple columns using TAKE(SORTBY in the Take Function?

I'm getting used to the Take Function. I have it working and using it with the Sortie Function. What I need to know is how to show multiple columns using that. Here is the practice tables

Mock Bills: Owed is a RANDBETWEEN and Paid references the Owed cell.

Take Test: What I need is to get the TAKE(SORTBY to show the Bills and Paid columns. I know there must be a a way to do it but I don't know enough about it to get it to work. Any help will be greatly appreciated.

I'm a big fan of the new Functions. I've been asking for UNIQUE since I 1st saw it added to Excel. Next I want to see SLICERS and DATA BARS.


Thanks, Frank


[Re-Titled by Moderator]

Mac mini

Posted on Apr 7, 2025 6:15 PM

Reply
Question marked as Top-ranking reply

Posted on Apr 7, 2025 9:33 PM

If you update "Mock Bills::A" to "Mock Bills::A:C" in both formulas, it will return three columns. In your formula, the function only looks at column A, so there isn't a third column for it to process.


[97]

8 replies

Apr 8, 2025 10:13 AM in response to franks4business

> And again I'd like to display just the sorted columns Bills and Paid.


but sorted based on what? It's easy to extract data from the Mock Bills table


SORTBY() takes three arguments, the data to extract (in this case, the Owned and Paid columns), the array to sort it by (in this case, the Bill Label column) and a (optional) sort order.

TAKE() then extracts a number of rows and columns from the result.


Given that, if I'm understanding your ask correctly, you can set Take Test:D2 to:


=TAKE(SORTBY(Owed:Paid,Mock Bills::A,1),5,2)


This tells Numbers to sort the Owed and Paid columns based on Column A of the Mock Bills table. It then returns 5 rows x 2 columns, equating to the Owed and Paid values, sorted by Bill. Is that not what you want?

Apr 8, 2025 12:43 PM in response to Camelot

Thank you very much. That worked after I changed 1 reference to show Bill:Paid. Works for top 5 and bottom 5.


I want to bring this into my budget to show the 5 most expnses and 5 least expenses.

How would I add >0 to the one showing the least amount of expenses as I have some that don't occur every year.


TAKE(SORTBY(Mock Bills::$A:C,Mock Bills::$A,1),−5,2


Thanks again, Frank

Apr 8, 2025 1:14 PM in response to franks4business

Please ignore the previous post as it was in error. This should be correct.


Thank you very much. That worked after I changed 1 reference to show Bill:Paid. Works for top 5 and bottom 5.


I want to bring this into my budget to show the 5 most expnses and 5 least expenses.

How would I add >0 to the one showing the least amount of expenses as I have some that don't occur every year.


TAKE(SORTBY(Mock Bills::$A:$C,Paid,-1),−5,2)


Thanks again, Frank


Apr 8, 2025 2:03 PM in response to franks4business

> How would I add >0 to the one showing the least amount of expenses as I have some that don't occur every year.


That's going to be a lot harder to do because the sort doesn't automatically exclude empty (or 0-value) cells.


It'll be harder, too, since it SORT() also doesn't ignore filtered fields on the source data, so you can't filter it there.


There may be some other array-based function to exclude the 0-values. Without seeing the larger sheet, it may also be that arrays aren't the best part, since it sounds like you're summarizing data, which pivot tables may be better suited to.

Apr 8, 2025 6:05 PM in response to franks4business

Possibly, but that's why I commented that it depends on your end goal.


In your original post, it looks like you have one table with multiple columns showing the high and low entries... that's fair enough:


Now, maybe I'm wrong, but I assume you're trying to set this up so that columns A/B show the top 5, and C/D show the bottom 5 entries. Is that right? If so, it might look like this:





If so, filters are going to get in your way. Let's say, for example, D2 (Bill 2's 'owed') contains 0 because it's not due, or there was no activity... using a filter to suppress 0 rows will remove (or, at least, hide) the entire row, including the Bill 6/high, which probably isn't what you want.


That might be overcome by using separate tables, rather than trying to create two logical groups of columns in one table, but that's why I said an understanding of what you're trying to achieve is better (and, to my earlier point) would be handled better by Pivot Tables.

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.

How to display multiple columns using TAKE(SORTBY in the Take Function?

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