LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 3
Default Variable reference to add cells

Wow!!

Cheers Jim, a great help
--
Nick


"Jim Thomlinson" wrote:

=INDEX(A1:E1,1,5-A5)+INDEX(A2:E2,1,5-A5)-SUM(INDEX(A4:E4,1,5-A5):E4)
--
HTH...

Jim Thomlinson


"Nick Savage" wrote:

Thanks Jim, I think I need to explain better:

I need a1:a2 and a4:e4 to be referenced from e3, using the value in a5
(the rows will always be 1 & 2 and 4 but the columns need to be dependent
on the value of a5 so

if a5 was 4 the answer would be 20 (a1:a2) - (a4:e4)

and if a5 was 3 the answer would be 12 (b1:b2) - (b4:e4)

key is to change a5 and have different answers without changing formula

a b c d e
1 10 5

2 20 15

3

4 2 2 2 2 2

5 4




Nick


"Jim Thomlinson" wrote:

If I understand your question correctly this should be close...

=SUM(A1:A2)-SUM(A4:INDEX(4:4, 1, A5+1))
--
HTH...

Jim Thomlinson


"Nick Savage" wrote:

I want to use a variable to add a number of cell values together:

in the example below cell 'e3' needs to be the sum of cells a1:a2 less the
sum of cells a4:e5 but I need to use the value of cell 'a5' to 'go back' 4
columns so that I can vary the number of columns to count back by changing
the value of a5.

a b c d e
1 10 5

2 20 15

3

4 2 2 2 2 2

5 4




Thanks



 
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
Using variable for cell reference bmurlidhar Excel Discussion (Misc queries) 3 July 17th 09 07:16 AM
How to reference variable range? WhatsUp31415 Excel Discussion (Misc queries) 4 May 17th 09 07:20 PM
Sum cells based on a row variable and seperate column variable CheeseHeadTransplant Excel Worksheet Functions 10 September 23rd 05 06:59 PM
How to use variable in reference Ming Excel Worksheet Functions 2 July 27th 05 11:24 PM
Problem with =sum(offset(cell reference,w,x,y,z). I want cell reference to be variable [email protected] Excel Worksheet Functions 2 December 11th 04 12:00 AM


All times are GMT +1. The time now is 03:52 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"