Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Indirect and offset

I can't figure out how to make the "A4" change to "A5" when I copy the
formula to the next row.

=SUM(INDIRECT("A4:A"&(B4-C4)))

My "B" column is probably redundant, it's just a counter for what row
I'm on. (It actually should be one more since I need a header row).
What I'm trying to do is Sum A4:A1 if C4 =4, (four rows), or if C4=1,
I want the sum of A4:A3.

Col A Col B(just a row counter) Col C Col D (sum I need)
2 1 1
4 2 0
6 3 2
9 4 1

I suppose column B can be omitted, and just use an offset from C ?

If the example above is legible, I would want the formula in D3 to be
the sum of A3:A1. (I need to offset A3 up two rows.)

Thanks, Tim




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Indirect and offset

=SUM(INDIRECT("A"&row()&":A"&(B4-C4)))

Tim wrote:

I can't figure out how to make the "A4" change to "A5" when I copy the
formula to the next row.

=SUM(INDIRECT("A4:A"&(B4-C4)))

My "B" column is probably redundant, it's just a counter for what row
I'm on. (It actually should be one more since I need a header row).
What I'm trying to do is Sum A4:A1 if C4 =4, (four rows), or if C4=1,
I want the sum of A4:A3.

Col A Col B(just a row counter) Col C Col D (sum I need)
2 1 1
4 2 0
6 3 2
9 4 1

I suppose column B can be omitted, and just use an offset from C ?

If the example above is legible, I would want the formula in D3 to be
the sum of A3:A1. (I need to offset A3 up two rows.)

Thanks, Tim


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Indirect and offset

The answer I get is 15 base on the example posted. The reason A4 will not
change is because it is a string in quotation marks and not a cell address
string.

The cells your formula is adding is A4 and A3. B4 = C4 is 4 - 1 = 3
That make your formula read Sum(Indirect("A4:A3")
Since you only have integers in column A, the Indirect is superfluous here.
You could just as well use =a4 + a3.

Maybe you need to look at the help file for the Indirect fundcion again to
understand how it works.

"Tim" wrote:

I can't figure out how to make the "A4" change to "A5" when I copy the
formula to the next row.

=SUM(INDIRECT("A4:A"&(B4-C4)))

My "B" column is probably redundant, it's just a counter for what row
I'm on. (It actually should be one more since I need a header row).
What I'm trying to do is Sum A4:A1 if C4 =4, (four rows), or if C4=1,
I want the sum of A4:A3.

Col A Col B(just a row counter) Col C Col D (sum I need)
2 1 1
4 2 0
6 3 2
9 4 1

I suppose column B can be omitted, and just use an offset from C ?

If the example above is legible, I would want the formula in D3 to be
the sum of A3:A1. (I need to offset A3 up two rows.)

Thanks, Tim





  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Indirect and offset

Cool. Thanks Dave!
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Indirect and offset

On Jan 21, 10:00*pm, JLGWhiz
wrote:
The answer I get is 15 base on the example posted. *The reason A4 will not
change is because it is a string in quotation marks and not a cell address
string.

The cells your formula is adding is A4 and A3. *B4 = C4 is 4 - 1 = 3
That make your formula readSum(Indirect("A4:A3")
Since you only have integers in column A, the Indirect is superfluous here. *
You could just as well use =a4 + a3.

Maybe you need to look at the help file for the Indirect fundcion again to
understand how it works.


Yea, I was trying to understand the examples in Indirect. Then I had
to find out what superfluous meant. Thanks anyway.
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
OFFSET and INDIRECT AirgasRob Excel Discussion (Misc queries) 1 June 16th 08 09:01 PM
Offset/Indirect Help [email protected] Excel Worksheet Functions 1 December 10th 07 07:04 PM
OFFSET and INDIRECT daniel # Excel Programming 1 May 12th 07 01:09 AM
Offset,Indirect Please help [email protected] Excel Discussion (Misc queries) 1 August 21st 06 10:54 PM
INDIRECT, OFFSET et. al. Wazooli Excel Worksheet Functions 2 March 24th 05 12:23 AM


All times are GMT +1. The time now is 06:00 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"