Look Up for Previous and Current in Table

Joined
Oct 29, 2015
Messages
42
Office Version
  1. 365
Platform
  1. Windows
Hi,

I have a summary table which summarises data from a given month. This is updated month on month as cost data is actualised.

On the left handside I want to include a formula which searches for the current and most recent "previous" period from the top row i.e. looking in the table to the right and finding the further occurence of "previous" on the right handside.

Can anyone help? Thanks


PreviousPreviousPreviousPreviousPreviousPreviousPreviousPreviousCurrent
CurrentPreviousMonth 1Month 2Month 3Month 4Month 5Month 6Month 7Month 8Month 9Month 10Month 11
Period X5267Period X
10​
25​
25​
34​
25​
26​
78​
67​
52​
Cumulative X342290Cumulative X
10​
35​
60​
94​
119​
145​
223​
290​
342​
Period Y43Period Y
1​
2​
2​
3​
2​
4​
2​
3​
4​
Cumulative Y2319Cumulative Y
1​
3​
5​
8​
10​
14​
16​
19​
23​
Period Z0.010.01Period Z
0.01​
0.01​
0.01​
0.01​
0.01​
0.01​
0.01​
0.01​
0.01​
Cumulative Z0.090.08Cumulative Z
0.01​
0.02​
0.03​
0.04​
0.05​
0.06​
0.07​
0.08​
0.09​
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Couple of XLOOKUPS seem to do the trick:

Book1
ABCDEFGHIJKLMNOP
1PreviousPreviousPreviousPreviousPreviousPreviousPreviousPreviousCurrent
2CurrentPreviousMonth 1Month 2Month 3Month 4Month 5Month 6Month 7Month 8Month 9Month 10Month 11
3Period X5267Period X102525342526786752
4Cumulative X342290Cumulative X10356094119145223290342
5Period Y43Period Y122324234
6Cumulative Y2319Cumulative Y13581014161923
7Period Z0.010.01Period Z0.010.010.010.010.010.010.010.010.01
8Cumulative Z0.090.08Cumulative Z0.010.020.030.040.050.060.070.080.09
Sheet1
Cell Formulas
RangeFormula
B3:B8B3=XLOOKUP($B$2,$F$1:$P$1,F3:P3)
C3:C8C3=XLOOKUP($C$2,$F$1:$P$1,F3:P3,,,-1)
 
Upvote 0
Solution
Or a spilled version:

Book1
ABCDEFGHIJKLMNOP
1PreviousPreviousPreviousPreviousPreviousPreviousPreviousPreviousCurrent
2CurrentPreviousMonth 1Month 2Month 3Month 4Month 5Month 6Month 7Month 8Month 9Month 10Month 11
3Period X5267Period X102525342526786752
4Cumulative X342290Cumulative X10356094119145223290342
5Period Y43Period Y122324234
6Cumulative Y2319Cumulative Y13581014161923
7Period Z0.010.01Period Z0.010.010.010.010.010.010.010.010.01
8Cumulative Z0.090.08Cumulative Z0.010.020.030.040.050.060.070.080.09
Sheet1
Cell Formulas
RangeFormula
B3:C8B3=CHOOSECOLS(TAKE(FILTER(F3:P8,F1:P1<>""),,-2),2,1)
Dynamic array formulas.
 
Upvote 0
Or a spilled version:

Book1
ABCDEFGHIJKLMNOP
1PreviousPreviousPreviousPreviousPreviousPreviousPreviousPreviousCurrent
2CurrentPreviousMonth 1Month 2Month 3Month 4Month 5Month 6Month 7Month 8Month 9Month 10Month 11
3Period X5267Period X102525342526786752
4Cumulative X342290Cumulative X10356094119145223290342
5Period Y43Period Y122324234
6Cumulative Y2319Cumulative Y13581014161923
7Period Z0.010.01Period Z0.010.010.010.010.010.010.010.010.01
8Cumulative Z0.090.08Cumulative Z0.010.020.030.040.050.060.070.080.09
Sheet1
Cell Formulas
RangeFormula
B3:C8B3=CHOOSECOLS(TAKE(FILTER(F3:P8,F1:P1<>""),,-2),2,1)
Dynamic array formulas.

Thank you - I have gone with the XLOOKUPS. :)
 
Upvote 0

Forum statistics

Threads
1,224,820
Messages
6,181,155
Members
453,021
Latest member
Justyna P

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