Forum Discussion
Help with lookup function
jletendre12 here is 1 solution:
=LET(tbl,CHOOSE(1+($C2="F"),M_PU_Scores,F_PU_Scores),v,XLOOKUP(60,INDEX(tbl,,MATCH($E2,VALUE(OFFSET(tbl,-1,0,1)))),OFFSET(tbl,,-1,,1),"na",1),v)and then update M_PU_Scores and F_PU_Scores for each category (see attached sheet)
so I made the formula to 'fit' the named ranges you already had, but it turned out I had to fix all those names because they were referring to your local sheet (i'm guessing you made a copy but the names still ref the original workbook with slightly different sheet names). The formula is a little wonky because I use offset with -1 to get the header (age) row and the row index column (count).
In any case if you want to know what is happening, the LET statement allows me to define a variable and in case that is to set tbl to either the male or female table. next I set 'v' to the answer and lastly I display V. As for how i calc 'v' it is a lookup for the value of 60 in the column that matches the age and then return the count.
Hope this works 🙂
- jletendre12May 24, 2021Copper ContributorThank you for your help.