Match? Index? Offset? HELP!

Murphyk

New Member
Joined
Jan 6, 2017
Messages
8
Hello, I'm hoping that someone can help. I have a business spreadsheet that I would like to update automatically. There are currently three calculations (a CAGR, a median and a sum in that order in the table below) performed on the past ten years of historic data. They only reference the historic data (i.e. 2016 and prior) rather than the forecasts, and it is easy to hard code the cells in each formula so that they work.

However, once a new year is added, I have to manually adjust each formula, as they should only perform the calculations on the past ten years (rather than including the forecasts). And there are dozens and dozens of them repeated for every division for every line of the accounts. And it's difficult to ensure that I've done it each time for every line!

The ideal is for Excel to recognise which column is the last year of historic data, and use that as the starting reference and go back 10 years to perform the calculations.

For a variety of reasons, I would prefer not to have excel use a data function to calculate the last historic year, but to recognise the that the last financial year does not have an 'e' next to the number. Or to introduce a specific reference for the latest financial data (a '1' entered once at the top of the column?). Whatever works, we can do that.

An example is below, and any help you can give would be wonderful.

Thanks.

20072008200920102011201220132014201520162017e2018e2019e2020eCalculation
Sales851009099981001051081151201211251301354% (C.A.G.R)
Costs-82-85-92-88-89-90-90-91-92-93-95-96-96-99-90
(Median)
Profit315-2119101517232726293436128
(Sum)

<tbody>
</tbody>
 

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
Works in testing:


Let's say the range you posted was in cells A1:P4,


Then in A1 (or whereever would be out of the way) you could drop an array formula that would tell you the first cell in the year headers that has an "e" in it:


{=MATCH(TRUE,ISNUMBER(FIND("e",B1:ZZ1)),0)}


(Note that this is an array formula, i.e. confirm with Ctrl+Shift+Enter) [The use of "ZZ1" as the back end of the FIND() call was arbitrary -- that would cover you for the next 700 years. You could just as easily select a much closer column like "BZ1".]


Then you can use this in OFFSET() functions to fetch the cells you wish to use:


Your Median formula would be:
=MEDIAN(OFFSET($B$1,ROW()-ROW($B$1),$A$1-COLUMN($B$1),1,-10))


Your Sum formula would be:
=SUM(OFFSET($B$1,ROW()-ROW($B$1),$A$1-COLUMN($B$1),1,-10))
 
Last edited:
Upvote 0
Thanks Greg for your swift response. The match array definitely works, but the others don't quite work for a reason I can't quite understand at the minute. They return values (which is better than I could manage!) but they're out for a reason I'm not sure on.

I'll test it over the weekend and come back to you with an explanation if that's OK. I imagine it's me not changing the formulas in the median and the sum correctly to ensure I get the 10 years in.

Cheers for your help so far.
 
Upvote 0
Use the Evaluate Formula tool on the Formulas tab to see where your other formulae are misbehaving.
 
Upvote 0
That's wonderful Greg. Evaluate tool is a GREAT feature.

It shows that your formulae work perfectly, and my cross-check of simply summing them was wrong as I had dragged an additional cell into the reference! What an idiot.

The last thing I would like to be able to do is to work out the Compound annual growth.

The basic excel formula for that is (Latest year)/(early year)^(1/years)-1.

By messing around with the formula you have already helped with, I can return the latest year using the match array you supplied above and:

=OFFSET($A$6,ROW()-ROW($A$6),$A$1-COLUMN($A$6))

However, I've been unable to work out how to return an individual cell that is 10 years prior to the latest. I thought a -10 would work, but I must have the syntax wrong as it returns #ref! error. Can anyone help??

Thanks in advance.
 
Upvote 0
I believe what you'd need would look about like this:

=(OFFSET($B$1,ROW()-ROW($B$1),$A$1-COLUMN($B$1),1,1)/OFFSET($B$1,ROW()-ROW($B$1),$A$1-COLUMN($B$1)-9,1,1))^(1/9)-1
 
Upvote 0
Re: Match? Index? Offset? HELP! v2.0

Hi,

As per the above, Greg kindly helped me sort out how to return the FIRST cell of forecast data by building a Match formula. The =(Match(true,isnumber(find("e",range)),0)) works perfectly, but I now have a follow on problem. I now need to return the column number of the LAST forecast year.

I can't simply add a constant number to the first formula as there will be a variable number of forecast years.

To complicate matters, it is possible there are other cells within the range off to the right hand side that contain plain text in, some of which may contain an "e". However, this will be a large amount of text, whilst our target cell will always have five digits, and be in the format 2018e or 2028e etc.

So I am trying to find a way to get the match formula to return the column reference for the last column with an "e" next to the year.

Hopefully, that makes sense. Can anyone help please?

Thanks
 
Upvote 0

Forum statistics

Threads
1,215,568
Messages
6,125,599
Members
449,238
Latest member
wcbyers

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