Home

VLOOKUP using user input to determine column

%3CLINGO-SUB%20id%3D%22lingo-sub-909647%22%20slang%3D%22en-US%22%3EVLOOKUP%20using%20user%20input%20to%20determine%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-909647%22%20slang%3D%22en-US%22%3E%3CP%3EStep1%3A%20User%20inputs%20data%26nbsp%3B%3C%2FP%3E%3CP%3EStep%202%3A%20User%20input%20is%20transferred%20to%202nd%20table%3C%2FP%3E%3CP%3EStep%203%3A%20Score%20column%20references%202nd%20sheet(Pushup)%20table%20to%20determine%20score.%20Uses%20reps%20to%20determine%20row%20and%20age%20for%20the%20column.%3C%2FP%3E%3CP%3EIssue%3A%20Having%20trouble%20with%20formula%20to%20reference%202nd%20sheet%20and%20find%20score%20attached%20to%20the%20user%20inputted%20age%20and%20reps.%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EFeel%20free%20to%20ask%20questions%3C%2FP%3E%3CP%3EThank%20you%20in%20advance!%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20565px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137244iE6BA68DA9D1503CB%2Fimage-dimensions%2F565x72%3Fv%3D1.0%22%20width%3D%22565%22%20height%3D%2272%22%20alt%3D%222.JPG%22%20title%3D%222.JPG%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20538px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137245iDB893D0387F3DCD8%2Fimage-dimensions%2F538x105%3Fv%3D1.0%22%20width%3D%22538%22%20height%3D%22105%22%20alt%3D%222.1.JPG%22%20title%3D%222.1.JPG%22%20%2F%3E%3C%2FSPAN%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20486px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137243i6F23D46B01926BE3%2Fimage-dimensions%2F486x455%3Fv%3D1.0%22%20width%3D%22486%22%20height%3D%22455%22%20alt%3D%221.4.JPG%22%20title%3D%221.4.JPG%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-909647%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EExcel%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EFormulas%20and%20Functions%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E%3CLINGO-SUB%20id%3D%22lingo-sub-909735%22%20slang%3D%22en-US%22%3ERe%3A%20VLOOKUP%20using%20user%20input%20to%20determine%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-909735%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F424732%22%20target%3D%22_blank%22%3E%40jman9635%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EFor%20such%20sample%20model%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20style%3D%22width%3A%20448px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Fgxcuf89792.i.lithium.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F137256iFCEAACE679531EAC%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20alt%3D%22image.png%22%20title%3D%22image.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3Eformula%20in%20H3%20could%20be%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-markup%22%3E%3CCODE%3E%3DIFNA(%0A%20%20INDEX(%0A%20%20%20%20%24B%245%3A%24D%2446%2C%0A%20%20%20%20MATCH(G3%2C%24A%245%3A%24A%2446%2C0)%2C%0A%20%20%20%20MATCH(1%2CINDEX((F3%26gt%3B%3D--LEFT(%24B%244%3A%24D%244%2C2))*(F3%26lt%3B%3D--RIGHT(%24B%244%3A%24D%244%2C2))%2C0)%2C0)%0A%20%20)%2C%0A%22no%20such%22)%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-910805%22%20slang%3D%22en-US%22%3ERe%3A%20VLOOKUP%20using%20user%20input%20to%20determine%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-910805%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F424732%22%20target%3D%22_blank%22%3E%40jman9635%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EInstead%20of%20snapshots%2C%20please%20attach%20your%20sample%20file%20next%20time%20so%20that%20the%20Community%20won''t%20painstakingly%20need%20to%20reproduce%20your%20data%20in%20a%20new%20Excel%20workbook%2C%20just%20as%20I%20did.%20In%20my%20earnest%20effort%20to%20furnish%20you%20with%20a%20probably%20acceptable%20solution%2C%20I%20hope%20that%20this%20formula%20in%20Sheet2!G4%20in%20the%20attached%20file%20will%20deliver%20your%20expected%20result%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DVLOOKUP(F4%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3ESheet3!A%245%3AI%2481%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3EMATCH(C4%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E--LEFT(Sheet3!B%244%3AI%244%2C2)%2C1)%2B1%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E0)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3ENote%20that%20the%20foregoing%20is%20an%20array%20formula%2C%20such%20that%20it%20must%20be%20confirmed%20with%20Ctrl%2BShift%2BEnter.%26nbsp%3B%3C%2FP%3E%3CP%3ELet%20me%20explain%20why%20it%20is%20an%20array%20formula.%20Neither%20the%20lookup_array%20argument%20of%20MATCH%20nor%20the%20col_index_num%20argument%20of%20VLOOKUP%20can%20process%20an%20array%20operation.%26nbsp%3B%3C%2FP%3E%3CP%3ETo%20convert%20to%20a%20non-array%20formula%2C%20the%20lookup_array%20argument%20of%20MATCH%20must%20be%20wrapped%20with%20INDEX%20like%20this%20formula%20in%20Sheet2!G5%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DVLOOKUP(F5%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3ESheet3!A%245%3AI%2481%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3EMATCH(C5%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3EINDEX(--LEFT(Sheet3!B%244%3AI%244%2C2)%2C0)%2C1)%2B1%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E0)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EBecause%20the%20array%20argument%20of%20INDEX%20openly%20processes%20array%20operations%2C%20the%20foregoing%20formula%20is%20confirmed%20with%20a%20regular%20Enter.%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-913137%22%20slang%3D%22en-US%22%3ERe%3A%20VLOOKUP%20using%20user%20input%20to%20determine%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-913137%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F280482%22%20target%3D%22_blank%22%3E%40Twifoo%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EThank%20you%20for%20taking%20time%20to%20respond.%20My%20apologizes%20for%20not%20attaching%20the%20file(%20you%20will%20find%20it%20attached%26nbsp%3B%20to%20this%20reply).%20I%20attempted%20to%20input%20your%20formulas%20into%26nbsp%3B%20my%20sheet%20referencing%20your%20example%2C%20however%20for%20some%20reason%20it%20didn't%20work%2C%20most%20likely%20due%20to%20an%20error%20on%20my%20part.%20You%20will%20find%26nbsp%3B%20my%20attempts%20to%20apply%20your%20formulas%20on%20the%20results%20sheet%20in%20the%20pushups%26nbsp%3B%20score%20column.%20Further%20help%20would%20be%20greatly%20appreciated.%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-914761%22%20slang%3D%22en-US%22%3ERe%3A%20VLOOKUP%20using%20user%20input%20to%20determine%20column%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-914761%22%20slang%3D%22en-US%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fuser%2Fviewprofilepage%2Fuser-id%2F424732%22%20target%3D%22_blank%22%3E%40jman9635%3C%2FA%3E%26nbsp%3B%3C%2FP%3E%3CP%3EIn%20the%20attached%20version%20of%20your%20file%2C%20the%20formula%20in%20G4%20is%3A%26nbsp%3B%3C%2FP%3E%3CP%3E%3CSTRONG%3E%3DVLOOKUP(F4%2CPushup!A%245%3AR%2482%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3EMATCH(C4%2CINDEX(--LEFT(Pushup!B%244%3AI%244%2C2)%2C%3C%2FSTRONG%3E%3CBR%20%2F%3E%3CSTRONG%3E0)%2C1)%2B1%2B9*(B4%3D%22F%22)%2C0)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3ENote%20that%20the%20formulas%20in%20I4%20and%20K4%20are%20similar%20to%20the%20foregoing.%20Please%20confirm%20if%20such%20formulas%20return%20your%20expected%20results.%3C%2FP%3E%3C%2FLINGO-BODY%3E
jman9635
New Contributor

Step1: User inputs data 

Step 2: User input is transferred to 2nd table

Step 3: Score column references 2nd sheet(Pushup) table to determine score. Uses reps to determine row and age for the column.

Issue: Having trouble with formula to reference 2nd sheet and find score attached to the user inputted age and reps. 

 

Feel free to ask questions

Thank you in advance!

 

 

2.JPG2.1.JPG1.4.JPG

6 Replies

@jman9635 

For such sample model

image.png

formula in H3 could be

=IFNA(
  INDEX(
    $B$5:$D$46,
    MATCH(G3,$A$5:$A$46,0),
    MATCH(1,INDEX((F3>=--LEFT($B$4:$D$4,2))*(F3<=--RIGHT($B$4:$D$4,2)),0),0)
  ),
"no such")

@jman9635 

Instead of snapshots, please attach your sample file next time so that the Community won''t painstakingly need to reproduce your data in a new Excel workbook, just as I did. In my earnest effort to furnish you with a probably acceptable solution, I hope that this formula in Sheet2!G4 in the attached file will deliver your expected result: 

=VLOOKUP(F4,
Sheet3!A$5:I$81,
MATCH(C4,
--LEFT(Sheet3!B$4:I$4,2),1)+1,
0)

Note that the foregoing is an array formula, such that it must be confirmed with Ctrl+Shift+Enter. 

Let me explain why it is an array formula. Neither the lookup_array argument of MATCH nor the col_index_num argument of VLOOKUP can process an array operation. 

To convert to a non-array formula, the lookup_array argument of MATCH must be wrapped with INDEX like this formula in Sheet2!G5: 

=VLOOKUP(F5,
Sheet3!A$5:I$81,
MATCH(C5,
INDEX(--LEFT(Sheet3!B$4:I$4,2),0),1)+1,
0)

Because the array argument of INDEX openly processes array operations, the foregoing formula is confirmed with a regular Enter.

@Twifoo 

Thank you for taking time to respond. My apologizes for not attaching the file( you will find it attached  to this reply). I attempted to input your formulas into  my sheet referencing your example, however for some reason it didn't work, most likely due to an error on my part. You will find  my attempts to apply your formulas on the results sheet in the pushups  score column. Further help would be greatly appreciated. 

@jman9635 

In the attached version of your file, the formula in G4 is: 

=VLOOKUP(F4,Pushup!A$5:R$82,
MATCH(C4,INDEX(--LEFT(Pushup!B$4:I$4,2),
0),1)+1+9*(B4="F"),0)

Note that the formulas in I4 and K4 are similar to the foregoing. Please confirm if such formulas return your expected results.

This worked, thank you very much!
I’m glad to know that I’ve helped you. I painstakingly did!
Related Conversations
Tabs and Dark Mode
cjc2112 in Discussions on
22 Replies
Stable version of Edge insider browser
HotCakeX in Discussions on
35 Replies
flashing a white screen while open new tab
cntvertex in Discussions on
13 Replies
How to Prevent Teams from Auto-Launch
chenrylee in Microsoft Teams on
28 Replies