XLOOKUP on Array with Same Entity on Multiple Lines

chasfh

Board Regular
Joined
Dec 10, 2014
Messages
54
Office Version
  1. 365
Platform
  1. Windows
I am trying to add classifications to my leagues based on year. Some leagues change classifications on a year-to-year basis.

I am trying to use XLOOKUP to look up the year and the league, and select the proper classification from a range.

The problem arises when a league changes classifications from year to year, and I end up with the same league name on multiple lines. See the example below.

I tried an array XLOOKUP:

=XLOOKUP(A4&B4,$F$3:$P$3&$E$4:$E$8,$F$4:$P$8))

... and I get #VALUE! for all the results.

Then I tried a nested XLOOKUP (the one on the XL2BB sheet below):

=XLOOKUP(A4,$F$3:$P$3,XLOOKUP(B4,$E$4:$E$8,$F$4:$P$8))

... and it works fine on leagues that never change classifications, but not on leagues that do. With leagues that do, it gives me correct results from the first line, but zeroes as the result on subsequent lines.

Obviously, I would have believed that even with multiple lines of the same league, it would look for the classification that matches the year properly, but apparently, as currently constructed, XLOOKUP doesn't work that way.

Please don't suggest I simply consolidate lines that have multiple leagues because there are hundreds of them, which will take me hours, and I'd rather not have to do that until we determine there is no solution for this.

Thanks!

YearLeagueClass19341935193619371938193919401941194219431944
1934InternationalBInternationalBBBBB
1934South AtlanticCAmericanCCCC
1935InternationalBSouth AtlanticCCC
1935South AtlanticCSouth AtlanticBBBB
1936InternationalBSouth AtlanticAAAA
1936South AtlanticC
1937InternationalB
1937South Atlantic0
1938InternationalB
1938South Atlantic0
1939South Atlantic0
1940South Atlantic0
1941AmericanC
1941South Atlantic0
1942AmericanC
1942South Atlantic0
1943AmericanC
1943South Atlantic0
1944AmericanC
1944South Atlantic0
 
That formula needs to go in A2 as I showed. Clear all cells in a2:c21 first
 
Upvote 0

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
I appreciate you guys trying to help and all but I just went in and consolidated all the lines anyway. Although I do think the problem I presented is a one which needs to be solved at some point.
 
Upvote 0
Any zeros in the right table will need to be removed. The formula works to remove blank cells. Search and replace entire cell contents for any zeros and replace with nothing.
They were never there for me!
 
Upvote 0
Although I do think the problem I presented is a one which needs to be solved at some point.
In what way didn't the formula I suggested in post#9 not do that?
 
Upvote 0
That formula needs to go in A2 as I showed. Clear all cells in a2:c21 first
It did work on the sample table I put together, but man, what a slog it must have been to put that monster formula together! Yikes! And when I repurposed it to the big honking table (Z4:FG891) I really needed it for, it #SPILL!ed anyway.

It just seems so much more intuitive to be able to do it with XLOOKUP in some form.
 
Upvote 0

Forum statistics

Threads
1,215,147
Messages
6,123,297
Members
449,095
Latest member
Chestertim

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top