Need to add cells depending on other cell.

Ashurk77

New Member
Joined
Jul 8, 2013
Messages
39
Hi
I need to add few cells.
But problem is My number of cells depend on other cells value.
E.G
I want to add values from column A
depending on value in cell B2

suppose its B2 is 2
so i will add A1 and A7
suppose b2 is 3
thn I will add A1 A7 and A13 and so on....

Can some one help.?

Thanks in advance

Refered: http://www.excelforum.com/excel-form...ml#post3488332
 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
If its as simple as you say, then something like this will work as your sum cell.

=IF(B2=2,SUM(A2+A7),IF(B2=3,SUM(A2+A7+A10),0))

Where B2 is either 2 or 3, it is adding either A2 and A7, or A2,A7 and A10 (if B2 is 3).
 
Upvote 0
Nop not poss as I told So on...
It goes on increasing.....
till 500 600 rows


I need to add few cells.
But problem is My number of cells depend on other cells value.
E.G
I want to add values from column AR
depending on value in cell P2

Right now m using
=(SUMIF(AQ$5:AQ$469,AX4,AR$5:AR$469))/P$2

but unsuccessful

suppose if P2 is 2
so i will add AR5 and AR13
suppose p2 is 3
thn I will add AR5 AR13 and AR21 and so on....


Can some one help.?

Thanks in advance
 
Last edited:
Upvote 0
There is a difference of 6 between your required cells. ie A1 A7 A13. Is this pattern throughout? Does it continue requiring A19, A25? as you enter 4 and 5 in B2?
 
Upvote 0
Hi,

=SUMPRODUCT(N(OFFSET($A$1,6*(ROW(INDIRECT("1:"&B2))-1),,,)))

Regards
 
Upvote 0
Is there something you don't like about this particular approach?

Regards
 
Upvote 0
Never heard of it. What functions are available to you? Can you post a link to a definitive list?

Regards
 
Upvote 0

Forum statistics

Threads
1,214,987
Messages
6,122,614
Members
449,091
Latest member
gaurav_7829

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