Excel Vlookup with cell reference

前端 未结 3 749
执笔经年
执笔经年 2021-01-28 04:12

I have a cell range that I named \"cell_range\" in Excel. I want to extract the fourth row and fifth column from this table. The formula,

=vlookup(4,cell_range,

3条回答
  •  遇见更好的自我
    2021-01-28 04:40

    While you can use INDIRECT to perform this kind of stuff, I steer clear of it for reasons I've outlined at https://chandoo.org/wp/2014/03/03/handle-volatile-functions-like-they-are-dynamite/

    In this particular case I'd use a lookup table and either CHOOSE or INDEX, as demonstrated in the screenshot below:

    Note that you need to pre-specify your areas with my approach.

    Here's the syntax for CHOOSE

    =CHOOSE(index_num,value1,value2,...)

    Here’s the translation from Microsoft-speak into Jeff-speak:

    =CHOOSE(Which area do you want?, First area, Second area, ...)

    If using a dropdown or a cell reference to provide the index_num argument, you simply use a lookup table that converts the output of the dropdown or cell input into an index number that tells CHOOSE which range from the list should be used.

    In this example, you’re using this approach to choose which area on the spreadsheet to sum. But CHOOSE and INDEX can be used to do a lot more than that. For instance, you could use them to allow a user to dynamically pick which lookup table to use when doing a VLOOKUP. Or you could let the user dynamically pick which range in which sheet to user for some calculations do. Very powerful stuff indeed!

提交回复
热议问题