Hlookup

MarkAndrews

Well-known Member
Hlookup Example.xls
OPQR
1January
25
312
419
526
633
740
847
954
1061
1168
1275
1382
1489
Sheet1

I have the above hlookup working, however In N1 i would like the month previous from what is selected in O1 (Which is validation list)

What formula should I use?

TIA

Excel Facts

Save Often
If you start asking yourself if now is a good time to save your Excel workbook, the answer is Yes

SydneyGeek

MrExcel MVP
Assuming the list lives in T1:T12,

Code:
``=IF(MATCH(O1,T1:T12,0)=1,INDEX(T1:T12,12,1),INDEX(T1:T12,MATCH(O1,T1:T12,0)-1,1))``

Denis

MarkAndrews

Well-known Member
Sorry Denis, I forgot to put where the data comes from
Hlookup Example.xls
ABCDEFGHIJKLM
1JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
Sheet1

SydneyGeek

MrExcel MVP
OK, same logic, just transposed.

Code:
``=IF(MATCH(O1,B1:M1,0)=1,INDEX(B1:M1,1,12),INDEX(B1:M1,1,MATCH(O1,B1:M1,0)-1))``

Denis

MarkAndrews

Well-known Member

Thanks Denis - Can i just fill this left to get the last 6 months automatically using this formula?

Thanks again

SydneyGeek

MrExcel MVP
You can fill it left or right if you use absolute references like this:
Code:
``=IF(MATCH(O2,\$B\$1:\$M\$1,0)=1,INDEX(\$B\$1:\$M\$1,1,12),INDEX(\$B\$1:\$M\$1,1,MATCH(O2,\$B\$1:\$M\$1,0)-1))``
Interestingly, the months go "backwards" whichever way you fill.

Denis

Thanks Denis

Replies
1
Views
174
Replies
3
Views
220
Replies
4
Views
122
Replies
3
Views
100
Replies
9
Views
319

1,141,587
Messages
5,707,258
Members
421,498
Latest member
matinebi

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.

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

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