Hlookup

MarkAndrews

Well-known Member
Joined
May 2, 2006
Messages
1,970
Office Version
  1. 2010
Platform
  1. Windows
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

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
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
 
Upvote 0
Sorry Denis, I forgot to put where the data comes from
Hlookup Example.xls
ABCDEFGHIJKLM
1JanuaryFebruaryMarchAprilMayJuneJulyAugustSeptemberOctoberNovemberDecember
Sheet1
 
Upvote 0
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
 
Upvote 0
Thanks Denis - Can i just fill this left to get the last 6 months automatically using this formula?

Thanks again
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,907
Messages
6,122,183
Members
449,071
Latest member
cdnMech

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