Two way lookup in a row for last row value

sdking

New Member
Joined
Oct 15, 2021
Messages
4
Office Version
  1. 2013
Platform
  1. Windows
Hello

I have a spreadsheet that my colleagues have been using for many years and want to maintain the structure of, but would like something new adding in - so unfortunately I can't change the layout to something more functional.

Worksheet one (/Data) lists the test results for a group of students similar to the below:
1683988930414.png

The UID cell is A1 and the column is made of merged cells, similarly column B is merged cells.

Worksheet two (/Summary) is the new aspect that will be a summary of the students. My colleagues would like for it to have the last value in each row for each of the students by topic, as below:
1683989323731.png

The UID cell is A1.

In the green squares with the ???s, my colleagues would like formulas that would lookup the UID and topic from Summary in Data and return that last result/last cell in that row.

Does anyone know if that's possible? Many thanks in advance, I hope it's quite clear but please let me know if you'd like clarification.

Thanks

SD
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Merged cells are aesthetically pleasing, but frequently difficult to deal with. Below is a solution that depends on a couple of additions:
1. Remove the merges so that UID and Name appear in every row. If you like you can change the font to match the cell background so they aren't visible. I have done this in the example below.
2. Add a column to the Data that returns the most recent scores.

Book1.xlsm
ABCDEFGHIJKLMNOP
1UIDNameTopic1/1/20232/1/20233/1/20234/1/20235/1/20236/1/20237/1/20238/1/20239/1/202310/1/202311/1/202312/1/2023Most Recent Score
22345HH JonesLanguage81499
32345HH JonesMaths12151313
42345HH JonesScience12101919
56876CC JonesLanguage31491313
66876CC JonesMaths15141414
76876CC JonesScience1416131515
8
9
10
11Most Recent Scores
12UIDNameLanguageMathsScience
132345HH Jones91319
146876CC Jones131415
Sheet8
Cell Formulas
RangeFormula
P2:P7P2=LOOKUP(1E+306,D2:O2)
C13:E14C13=INDEX($A$2:$P$7,MATCH(($A13&C$12),($A$2:$A$7)&($C$2:$C$7),0),16)
 
Upvote 0
Hello

I have a spreadsheet that my colleagues have been using for many years and want to maintain the structure of, but would like something new adding in - so unfortunately I can't change the layout to something more functional.

Worksheet one (/Data) lists the test results for a group of students similar to the below:
View attachment 91580
The UID cell is A1 and the column is made of merged cells, similarly column B is merged cells.

Worksheet two (/Summary) is the new aspect that will be a summary of the students. My colleagues would like for it to have the last value in each row for each of the students by topic, as below:
View attachment 91581
The UID cell is A1.

In the green squares with the ???s, my colleagues would like formulas that would lookup the UID and topic from Summary in Data and return that last result/last cell in that row.

Does anyone know if that's possible? Many thanks in advance, I hope it's quite clear but please let me know if you'd like clarification.

Thanks

SD
I assume that this grows horizontally as dates are added and that you don't want to have to alter formula to accommodate that.

The existing layout is not very functional but as you say, this cnanot be changed.

Combinations.xlsm
ABCDE
1UIDNameLanguageMathScience
21234HH Jones411644
35678CC Jones491916
49101TT Jones403740
51123PP Jones113313
Summary
Cell Formulas
RangeFormula
C2:C5C2=IFNA(LOOKUP(1E+306,OFFSET(Data!$A$1,MATCH($A2,Data!$A:$A,0)-1,3,1,COUNTA(Data!$1:$1)-3)),"")
D2:D5D2=IFNA(LOOKUP(1E+306,OFFSET(Data!$A$1,MATCH($A2,Data!$A:$A,0),3,1,COUNTA(Data!$1:$1)-3)),"")
E2:E5E2=IFNA(LOOKUP(1E+306,OFFSET(Data!$A$1,MATCH($A2,Data!$A:$A,0)+1,3,1,COUNTA(Data!$1:$1)-3)),"")
 
Upvote 0
I think that a sort of combination of the two suggestions above but avoiding helper columns, change of layout and the volatile function OFFSET can be achieved.
It does assume that the Language, Maths, Science rows do appear for each student and in the same order and also that is the same order as at the top of the results - as per your sample.

IFNA could be used to hide the #N/A result as per post #3 but I thought that it may be prudent to highlight it if a student has no result for a particular subject.

Where I have used 99, use any number that is sure to be larger that any student value.

23 05 14.xlsm
BCDEFGHIJKLMNO
1NameTopic1/01/20232/01/20233/01/20234/01/20235/01/20236/01/20237/01/20238/01/20239/01/202310/01/202311/01/202312/01/2023
2H JonesLanguage8149
3Maths121513
4Science121019
5C JonesLanguage314913
6Maths151414
7Science14161315
8T JonesLanguage10
9Maths
10Science15
11
12
13
14NameMost recent languageMost recent mathsMost recent science
15H Jones91319
16C Jones131415
17T Jones10#N/A15
Latest Results
Cell Formulas
RangeFormula
C15:E17C15=LOOKUP(99,INDEX($D$2:$O$10,MATCH($B15,$B$2:$B$10,0)-1+COLUMNS($C:C),0))
 
Upvote 0
The tendancy to use short and fat rather than long and thin data sets with additional columns used instead of additional rows for only when
there is something to represent makes subsequent analysis more difficult. Long and thing data sets tend to enable more flexibility.

Turning one layout into the other, even just for the purposes of analysis, would not be too difficult.

In this case, the layout was inherited so cannot be changed.

I did not know that OFFSET was a volatile function Peter_SSs. Is there a list of these somewhere?
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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