Vlookup for Multiple Rows Ranges

JayDeeExcel

New Member
Joined
Feb 22, 2017
Messages
3
Hello Friends,

I am trying to write a vlookup formula on a sheet that contains large data for all the months. Every month has same number of consumers.

Consumer No.MonthValue
1Janabc
2Jandef
3Janghi
1Febjkl
2Febmno
3Febpqr
1Marstu
2Marvwx
3Marisp
1Aprpsi
2Aprhgf
3Aprabs

<tbody>
</tbody>

So instead of telling excel the starting and ending range for a particular month in a hard coded manner, I want to write a formula that translates into month's range depending upon the selection of month from user. For e.g. lookup range for feb should be A4:C6.

I tried to write different formulas but haven't succeeded as yet. I used address, index and cell for this in vlookup. For e.g. =VLOOKUP(K1,"$A$1"&":"&CELL("address",INDEX(B1:B566488,MATCH(L3,B1:B566488,0),0)),2,0)

where K1 is customer id to look for and L3 contains the name of month

It translates into right range but excel returns #Value error.

I have used many methods but in vain so far. Is it something to do with excel returning text instead of range or something else?

Please help with formula and if possible with concept.

Thanks!
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
Welcome to the forum.

Try:

ABCDEFGHIJKLM
1ConsumerNo.MonthValue2
21Janabc
32JandefMarvwx
43Janghi
51Febjkl
62Febmno
73Febpqr
81Marstu
92Marvwx
103Marisp
111Aprpsi
122Aprhgf
133Aprabs

<colgroup><col style="width: 25pxpx"><col><col><col><col><col><col><col><col><col><col><col><col><col></colgroup><thead>
</thead><tbody>
</tbody>
Sheet10

Array Formulas
CellFormula
M3{=INDEX(C2:C13,MATCH(K1&"|"&L3,$A$2:$A$13&"|"&$B$2:$B$13,0))}

<thead>
</thead><tbody>
</tbody>
Entered with Ctrl+Shift+Enter. If entered correctly, Excel will surround with curly braces {}.
Note: Do not try and enter the {} manually yourself

<tbody>
</tbody>



That's an array formula, make sure to use Control+Shift+Enter when putting it in the formula bar.
 
Upvote 0
Thank you Eric for an elegant solution.

Can you recommend me a good book to read about array formulas with match and index? or any other resource?

Best Regards!
 
Upvote 0
I'm glad that works for you! :cool:

As far as Excel resources, I'm largely self-taught, so I can't really recommend anything from personal experience. However, there is an absolute wealth of information online, and books and videos, depending on your personal learning style.

The Mr. Excel books are generally well-respected, and here's one specifically about array formulas:

Excel, Excel 2010, Excel 2013, Microsoft Excel


As far as other resources, hiker95 has compiled an incredible list pointing to web links or YouTube, or search terms:

https://www.mrexcel.com/forum/excel...best-way-learn-visual-basic-applications.html

Go to the last post in that thread and scan the descriptions for something that matches what you want to study.

Good luck, and feel free to come back if you have any more questions! :)
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

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