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.
[TABLE="width: 224"]
<tbody>[TR]
[TD]Consumer No.[/TD]
[TD]Month[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Jan[/TD]
[TD]abc[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jan[/TD]
[TD]def[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Jan[/TD]
[TD]ghi[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Feb[/TD]
[TD]jkl[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Feb[/TD]
[TD]mno[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Feb[/TD]
[TD]pqr[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Mar[/TD]
[TD]stu[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Mar[/TD]
[TD]vwx[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Mar[/TD]
[TD]isp[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Apr[/TD]
[TD]psi[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Apr[/TD]
[TD]hgf[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Apr[/TD]
[TD]abs[/TD]
[/TR]
</tbody>[/TABLE]
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!
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.
[TABLE="width: 224"]
<tbody>[TR]
[TD]Consumer No.[/TD]
[TD]Month[/TD]
[TD]Value[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Jan[/TD]
[TD]abc[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Jan[/TD]
[TD]def[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Jan[/TD]
[TD]ghi[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Feb[/TD]
[TD]jkl[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Feb[/TD]
[TD]mno[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Feb[/TD]
[TD]pqr[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Mar[/TD]
[TD]stu[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Mar[/TD]
[TD]vwx[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Mar[/TD]
[TD]isp[/TD]
[/TR]
[TR]
[TD]1[/TD]
[TD]Apr[/TD]
[TD]psi[/TD]
[/TR]
[TR]
[TD]2[/TD]
[TD]Apr[/TD]
[TD]hgf[/TD]
[/TR]
[TR]
[TD]3[/TD]
[TD]Apr[/TD]
[TD]abs[/TD]
[/TR]
</tbody>[/TABLE]
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!