Never mind Myrna, I figured it out
Anyway, do you mean that I cannot calculate the YTD figures if my fiscal year begins in December rather than January?? If your answer is yes, then, do I have to change the third argument of your formula every other month?
----- Rafa Zorrilla wrote: ----
In your formula
=SumEveryThirdColumn(G10:$AV10,8
this third argument (the 8) is what
----- Myrna Larson wrote: ----
The formula I provided for Sarah has the data for a given month in 1 column
3 rows. You have it side-by-side. So the first formula will definitely no
work
You say the data goes from December through November. Are you dealing with
fiscal year that starts in December rather than a calendar year that start
in January? If so, you can't use the month number directly to determine ho
many cells to include. BTW, if A6 contains the formula =TODAY(), it contain
a complete date, with day, month, and year, even though you have chosen t
display only the month
You say there are 3 columns for each month, and the data is in E10:AV10
That is 44 columns, not 36, so I'm not sure of your layout at all
Anyway, here's a macro that will sum every third column in the first row o
a HORIZONTAL range, beginning with the 1st cell in the range, and includin
the number of values (i.e. the number of months) specified by NumToSum
So if you want to do the budget figures, which are in the 1st, 4th, 7th, et
columns of the block, and you want to do the first 8 months, the formula i
=SumEveryThirdColumn(E10:$AV10,8
To do the Actual figures in columns 2, 5, 8, etc, of the block, it'
=SumEveryThirdColumn(F10:$AV10,8
For the variance
=SumEveryThirdColumn(G10:$AV10,8
You'll have to work out the formula to determine the number of values to b
included based on the date in A6. You would substitute that calculate
number of months for the 3rd argument, the 8, in the above examples
Option Explici
Function SumEveryThirdColumn(Rng As Range, NumToSum As Long) As Varian
Dim C As Lon
Dim N As Lon
Dim Total As Doubl
Dim x As Varian
x = Rng.Valu
C =
N =
Total =
Do While C <= UBound(x, 2) And N < NumToSu
Total = Total + x(1, C
C = C +
N = N +
Loo
SumEveryThirdColumn = Tota
End Functio
Rafa Zorrilla said:
I need a formula that calculates Year-To-Date figures automatically
without editing the existing formula each month. My table is divided i
months (December 2003 to November 2004). Each month has three columns: 1
budget, 2) Actual figures, and 3)Variation from budget. I thought this wa
going to be easy but I've been working in it for a week without goo
results. I need a formula that can calculate automatically year to dat
figures. It is important to say that budget figures changes every othe
month
The composition of the table is as follows
1. In cell A6 is the current date [=today()] (MONTH ONLY
2. Data is on cells e10:av10 (There are 46 rows in the table, but figurin
out how it works in one row will make the remaining
3. YTD Results are in cells BA10:BC10 [Budget, Actual, Variation (on column for each result)
4. 6 months sub totals are in cells x10:z10 (these figures are the sum o the first 6 months)
Since I speak english as a second language, I really hope that you can
understand what I need. Please let me know if you need any further
information.not working. Can I email you my spreadsheet so you can take a look at it? If
so, please email me (
[email protected]) so I can reply you with the
attachment.
----- Myrna Larson wrote: -----
For last year's YTD: =SUM(OFFSET($A$3,0,0,1,MOD(MONTH($A$1)-7,12)+1))
For this year's YTD: =SUM(OFFSET($Y$3,0,0,1,MOD(MONTH($A$1)-7,12)+1))