ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Making ranges adjust automatically (https://www.excelbanter.com/excel-programming/415968-making-ranges-adjust-automatically.html)

Nelson B.

Making ranges adjust automatically
 
I desperately need some help with varying a range in a function. I'm trying
to make some of my reports more automated, and I would like to be able to
fill out one reference cell with the current month and have the formulas now
include any new data into their calculations. I can't simply use yearly
totals as I often want to compare the same time period last year to the
current YTD.

For example, if January's data is in cell C4 and I want to add the current
YTD I'd like to be able to write a formula that is SUM(C4:C("current month")).



Mike H

Making ranges adjust automatically
 
You've posted this question several times and have several answers that you
haven't responded to. Whats' wrong with those answers?

"Nelson B." wrote:

I desperately need some help with varying a range in a function. I'm trying
to make some of my reports more automated, and I would like to be able to
fill out one reference cell with the current month and have the formulas now
include any new data into their calculations. I can't simply use yearly
totals as I often want to compare the same time period last year to the
current YTD.

For example, if January's data is in cell C4 and I want to add the current
YTD I'd like to be able to write a formula that is SUM(C4:C("current month")).



Bernie Deitrick

Making ranges adjust automatically
 
Nelson,

For example, if January's data is in cell C4 and I want to add the current
YTD I'd like to be able to write a formula that is SUM(C4:C("current month")).


=SUM(OFFSET(C4,0,0,MONTH(TODAY()),1))

HTH,
Bernie
MS Excel MVP


"Nelson B." wrote in message
...
I desperately need some help with varying a range in a function. I'm trying
to make some of my reports more automated, and I would like to be able to
fill out one reference cell with the current month and have the formulas now
include any new data into their calculations. I can't simply use yearly
totals as I often want to compare the same time period last year to the
current YTD.






Nelson B.

Making ranges adjust automatically
 
I haven't been able to get those answers to work. The answer from JMay works
for me in some situations, but I'm unclear on the variables in the address
formula, and can't seem to adjust them to suit my needs. His answer is below:

Better alter cell A1 below to $A$1

=SUM(B3:INDIRECT(ADDRESS(3,A1+1,4)))
to
=SUM(B3:INDIRECT(ADDRESS(3,$A$1+1,4)))

so when you copy the formula down it works !!


"JMay" wrote:

Sample:
A1 = 3 << Your Variable (months or columns to stretch out to)

B3 = 123
C3 = 456
D3 = 789

formula in cell A3

=SUM(B3:INDIRECT(ADDRESS(3,A1+1,4)))

HTH,



I did actually reply to his post and did not receive an answer. I've since
figured out the replied question, but still cannot get the solution to work
for me consistently. So I thought I'd re-post and try again. I had no idea
it would upset you so greatly.

"Mike H" wrote:

You've posted this question several times and have several answers that you
haven't responded to. Whats' wrong with those answers?

"Nelson B." wrote:

I desperately need some help with varying a range in a function. I'm trying
to make some of my reports more automated, and I would like to be able to
fill out one reference cell with the current month and have the formulas now
include any new data into their calculations. I can't simply use yearly
totals as I often want to compare the same time period last year to the
current YTD.

For example, if January's data is in cell C4 and I want to add the current
YTD I'd like to be able to write a formula that is SUM(C4:C("current month")).




All times are GMT +1. The time now is 04:17 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com