M
Marcus Schöneborn
Is it possible to make a VLOOKUP-like function that looks at the rows in
reverse order, that is, so that it finds the bottom-most matching cell,
not the top-most one?
I know it can be done in VBA, but any attempt to do so ended up being
awfully slow. Actually, it ended up being about as slow as SUMPRODUCT on
the same dataset, so I conclude that VLOOKUP has some optimization I
don't know of and can't really be replicated in VBA.
BTW, I use an equality matching VLOOKUP. If I could sort my data by the
search key, I could of course answer the question on my own by making a
binary search function, but the column I need to search in is unsorted
and that can't be changed.
If possible, I'd like a solution without extra columns... basically, my
task is:
A B C D
1 Key1 y blah...
2 Key2 n blah...
3 Key3 y blah...
4 ^1 Key1 n blah...
5 ^3 Key3 n blah...
6 ^2 Key2 y blah...
7 Key4 y blah...
8 ^4 Key1 y blah...
9 ^5 Key2 n blah...
The ^N is supposed to be a "link" to the row with the previous occurrence
of the key. It is easy to find the FIRST occurrence in the row...
Actually, I want both that "link" and a check if the value in the C
column is the same (for each key in B, the value in C is required to be
the same). If this were SQL, I would of course make an extra B -> C
mapping worksheet, but that substantially hinders data entry in Excel,
which is why I instead want to show a consistency check while typing -
but that can be an ordinary VLOOKUP - however, I also want a link to the
previous instance of the same key to "walk up" the texts in D. A "next"
link OTOH is a normal VLOOKUP again...
speaking of links, is it possible to make a clickable hyperlink in a
cell that sets the cursor elsewhere, and not just showing a data item
ID?
reverse order, that is, so that it finds the bottom-most matching cell,
not the top-most one?
I know it can be done in VBA, but any attempt to do so ended up being
awfully slow. Actually, it ended up being about as slow as SUMPRODUCT on
the same dataset, so I conclude that VLOOKUP has some optimization I
don't know of and can't really be replicated in VBA.
BTW, I use an equality matching VLOOKUP. If I could sort my data by the
search key, I could of course answer the question on my own by making a
binary search function, but the column I need to search in is unsorted
and that can't be changed.
If possible, I'd like a solution without extra columns... basically, my
task is:
A B C D
1 Key1 y blah...
2 Key2 n blah...
3 Key3 y blah...
4 ^1 Key1 n blah...
5 ^3 Key3 n blah...
6 ^2 Key2 y blah...
7 Key4 y blah...
8 ^4 Key1 y blah...
9 ^5 Key2 n blah...
The ^N is supposed to be a "link" to the row with the previous occurrence
of the key. It is easy to find the FIRST occurrence in the row...
Actually, I want both that "link" and a check if the value in the C
column is the same (for each key in B, the value in C is required to be
the same). If this were SQL, I would of course make an extra B -> C
mapping worksheet, but that substantially hinders data entry in Excel,
which is why I instead want to show a consistency check while typing -
but that can be an ordinary VLOOKUP - however, I also want a link to the
previous instance of the same key to "walk up" the texts in D. A "next"
link OTOH is a normal VLOOKUP again...
speaking of links, is it possible to make a clickable hyperlink in a
cell that sets the cursor elsewhere, and not just showing a data item
ID?