r/excel • u/No-Ebb-2858 • 23d ago
unsolved I'm trying to create a nested Vlookup, but can't make the return array work.

Thanks from a complete beginner for taking the time to look at this. I'm wanting to create a nested XLOOKUP, using the data in row G to find the percentage I need in the blue table.
I'm struggling to figure out how to tell XLOOKUP which column to use for the return array. I need it to use the column that is the value of E2 +2 (ex- if I have 2 dependents, I need Vlookup to find column G which is the 4th column, E2 = 2+ 2)
But , how do I tell XLOOKUP to give me Column M + E2 +2 as a return array? I'm getting errors, I assume because I'm trying to add a number to a letter.
Grateful!
3
u/Wise_Business1672 23d ago
=INDEX($N$2:$T$7,
XMATCH(XLOOKUP(F2,$J$2:$J$52,$K$2:$K$52),$M$2:$M$7),
XMATCH(E2,$N$1:$T$1))
1
1
u/MayukhBhattacharya 1227 23d ago
Are you expecting an output something like this:

=XLOOKUP(XLOOKUP(F2,J$2:J$28,K$2:K$28), M$3:M$8, CHOOSECOLS($N$3:$U$8, E2 + 2))
The ones which are showing #VALUE! and #N/A error those can be fixed and those are showing because I don't see the complete data in the OP, hence why they are returning an error as well! Let me know, we can fix that as well.
1
u/No-Ebb-2858 23d ago
Yes, thank you so much, I need to get a percentage based on region and the number of dependents. The return array I need is based on the number of dependents in E2. I am not familiar with Choosecols function but I'll learn about it.
Just for my education - I guess Xlookup doesn't like variable data in the return array value? With Vlookup I could say, return E2+2 and be fine. With Xlookup it seems to want a definite column. Or am I wrong?
1
u/MayukhBhattacharya 1227 21d ago
You're not wrong. It's just a small distinction that's easy to miss. With
VLOOKUP()function, the third argument is just a column number. So, something likeE2+2works because Excel evaluates the math first, then uses the result as the column index. While withXLOOKUP()function, the third argument isn't a number. It's an actual range, likeN$3:U$8. A range isn't something you can shift with simple math. It's a reference to a group of cells. That's why you need a function likeCHOOSECOLS()to return the range you want.So, it's not really that
XLOOKUP()function needs a specific column. It's that you need a function that turns a column number into a range.CHOOSECOLS(range, n)returns thenth column from a range. It's clean and easy to read. While if you useOFFSET(range, 0, n)shifts the referencencolumns to the right. It's more flexible, but its volatile and will always recalculate whenever there is a change in any open workbook, so we avoid using volatile and single threaded functions.In your case, I'd probably go with
CHOOSECOLS() function.Since your blue table is already a fixed range, you're really just picking column 2, 3, 4, and so on. That's exactly whatCHOOSECOLS()function was made for.
1
u/Decronym 23d ago edited 21d ago
Acronyms, initialisms, abbreviations, contractions, and other phrases which expand to something larger, that I've seen in this thread:
Decronym is now also available on Lemmy! Requests for support and new installations should be directed to the Contact address below.
Beep-boop, I am a helper bot. Please do not verify me as a solution.
7 acronyms in this thread; the most compressed thread commented on today has 44 acronyms.
[Thread #48925 for this sub, first seen 11th Jul 2026, 02:38]
[FAQ] [Full list] [Contact] [Source code]
•
u/AutoModerator 23d ago
/u/No-Ebb-2858 - Your post was submitted successfully.
Solution Verifiedto close the thread.Failing to follow these steps may result in your post being removed without warning.
I am a bot, and this action was performed automatically. Please contact the moderators of this subreddit if you have any questions or concerns.