Fairly complex formula needed.

Traderjoe56

New Member
Joined
Jun 22, 2011
Messages
9
Hi everyone,

Thanks ahead of time for anyone that helps with this problem. basically I have a couple hundred of rows of countries, and data columns for years, with the final column calculating the average annual % change for preferably a 5 year span. The problem is, the data is spotty, and I need to change the formula manually for a number of countries. What I would like, is a macro/formula that can look for the first non zero year. Whatever that year is serves as an anchor. I then want the formula to go back five years, and check if that's non zero. if it is, I want it to run say the formula, (=(I21-E21)/E21/4) to basically calculate the average annual % change for five years. if it's zero, I want it to expand to the 6th year... and if that's zero, the 7th year... until it reaches the 8th year, and then I want it to snap back into the 4th year, 3rd year, and finally the 2nd year.... in other words, i'm trying to create something that can fill in the final three columns of what's in the picture.

DropBox


Hope this makes sense, and again, thanks in advance for whatever help you can give....

Joe
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
my apologies... and I'm not entirely sure if I'm using excel Jeanie right. After a bit of talking with the person in charge of the project, I've actually redefined what the algorithm should be doing:
1. Starting from 2009 and working backwards, find the first, non zero value. let this be (M)
2. starting from 2005, and working forward, find the first non zero value. let this be (N)
3. if (1) and (2) are different years, calculate average annual % change and spit it out using the formula ((M)-(N))/(N)/(interval between M and N)
4. also if possible, calculate % change using (M-N)/N, and print out the year intervals of m and n (i.e. 2005-2008)

I'm gonna paste what excel jeanie is spitting out, and hoping this will look alright once posted.

Thanks again for any help!
Joe

Excel Workbook
ABCDEFGHIJKLM
1Countries*20022003200420052006200720082009Average Annual % Change 2005-2009 *% Change 2005-2009**different year interval
2Philippines*2.83.03.23.23.03.44.04.20.0820.33*
3Nicaragua*1.92.12.52.72.73.02.9-0.0230.072005-2008
4Venezuela*-3.33.43.02.62.5---0.071-0.142005-2007
5El Salvador*--5.25.45.5---0.0230.052005-2006
6Kazakhstan*--------***
7France*4.1------5.0***
8Mongolia*3.93.9-*4.0**3.6-0.033-0.102005-2008
Sheet1
 
Upvote 0
Upvote 0
The numbers will be slightly different to yours, as I believe that yours have more than 2 decimal places for the actual stored values, and I am simply using the figures shown.
 
Upvote 0
Hi Glenn,

I think this will actually do it. I tried an approach using VBA and a user defined function, but am not sure if i had it working correctly.

Thanks again for all your help, I definitely appreciate it!

Joe
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,702
Members
452,938
Latest member
babeneker

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