Why do some functions only work in the first column?

Hello.

I have a column (B) with a bunch of values (in this case dates).

I'd like these dates automatically re-ordered in ascending order in a second column.

For some reason I can't seem to get the formula to work unless it's in the very first column of a table (A).

In the screenshot, the formula works both in the "Entries Table" and in the "Sorted Table" so long as it's in column A, but refuses it work in any other column (e.g., D).


Since I want to automatically re-order the data of a bunch of columns in one big table to create various charts, I have to create an entirely new table for every set of data I want to reorder since there's only one first column in the table... I'm just trying to understand why Numbers won't let me use that formula in any column and if there is a way to make it work!


Anyone? Thank you!


iMac 27″, macOS 13.6

Posted on Apr 16, 2024 5:46 AM

Reply
Question marked as Best reply

Posted on Apr 16, 2024 7:39 AM

That's not how you use VLOOKUP, and you don't need VLOOKUP.

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

The search-for parameter and columns-range parameter are correct for how you are using it but the "return-column" needs to always be 1 because columns-range only has one column. When you use COLUMN(cell) as that number, it is 1 in column A but not in any other column. Regardless, there is no need to use VLOOKUP when you already have the value you are looking for (i.e., the search-for parameter) which you got by using the SMALL function.


With "Entries" being column B,

=IFERROR(SMALL(B, ROW()-1),"")


The blue triangles are from including empty rows in the SMALL function. One way to get around that is

=IFERROR(SMALL(OFFSET(B$1,1,0,COUNT(B),1),ROW()−1),"")

5 replies
Question marked as Best reply

Apr 16, 2024 7:39 AM in response to thegoddelusion

That's not how you use VLOOKUP, and you don't need VLOOKUP.

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

The search-for parameter and columns-range parameter are correct for how you are using it but the "return-column" needs to always be 1 because columns-range only has one column. When you use COLUMN(cell) as that number, it is 1 in column A but not in any other column. Regardless, there is no need to use VLOOKUP when you already have the value you are looking for (i.e., the search-for parameter) which you got by using the SMALL function.


With "Entries" being column B,

=IFERROR(SMALL(B, ROW()-1),"")


The blue triangles are from including empty rows in the SMALL function. One way to get around that is

=IFERROR(SMALL(OFFSET(B$1,1,0,COUNT(B),1),ROW()−1),"")

Apr 16, 2024 6:35 PM in response to thegoddelusion

The blue warning triangles are just annoying to look at. They cause no problems. You can get rid of them by not having extra (blank) rows in 'Entries Table' or by limiting the range to only the populated rows. You are right to be concerned about using OFFSET in thousands of rows of formulas. It is supposedly a slow function. It might not matter but it is a consideration as the row count grows.


VLOOKUP can be used to return the value from column C but XLOOKUP is newer and better. There may be some cases where VLOOKUP is better but this isn't one of them.


Formula in column C of Sorted Table would be

=XLOOKUP(B,Entries Table::B,Entries Table::C,"not found",0)

Why do some functions only work in the first column?

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