Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Junior Member
 
Posts: 3
Default How to sum adjacent cells based on values of each cell?

Good day to all!
I'm hitting a brick wall in trying to set up a formula in Excel so I've come for help. It seems like it should be an easy =sumif or If/then formula but haven't been able to accomplish yet.
I can't see where I'm able to insert a picture or print screen of what I have, so I'll just use a very basic example.
Here are the values in my cells:
A1=0
B1=40
A2=10
B2=15
A3=30
B3=20
A4=10
B4=0


What I want to do is have an auto sum in cell B5 that does the following:
Add the total of column B amounts, only if greater than 0, but only if the cell in column A has an amount greater than 0 also, in the adjacent cell. For example, B2 would be added in the sum because A2 has an amount greater than 0 also. Cell B3 would also be added because cell A3 has an amount greater than 0 also. B1 and B4 would not be added in the total sum because cell A1 is 0 and cell B4 is 0. So my total in cell B5 would be 35.
Basically, just adding column B amounts only, and only if column B row has an amount AND column A of the same row has an amount.
I hope that makes sense!
Looking forward to hearing from anyone who can help with this.
Thanks!

Last edited by redlegend : October 13th 14 at 07:30 PM Reason: trying to insert an example
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default How to sum adjacent cells based on values of each cell?

hi,

Am Mon, 13 Oct 2014 19:19:32 +0100 schrieb redlegend:

A1=0
B1=40
A2=10
B2=15
A3=30
B3=20
A4=10
B4=0


a 0 in column B does NOT change the sum and so it must not be ignored.
Try:
=SUMIF(A1:A4,"0",B1:B4)


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,872
Default How to sum adjacent cells based on values of each cell?

Hi,

Am Mon, 13 Oct 2014 20:54:07 +0200 schrieb Claus Busch:

=SUMIF(A1:A4,"0",B1:B4)


if there can be values < 0 in column B then try:
=SUMIFS(B1:B4,A1:A4,"0",B1:B4,"0")
or
=SUMPRODUCT(--(A1:A40),--(B1:B40),B1:B4)


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional
  #4   Report Post  
Junior Member
 
Posts: 3
Default

Quote:
Originally Posted by Claus Busch View Post
hi,

Am Mon, 13 Oct 2014 19:19:32 +0100 schrieb redlegend:

A1=0
B1=40
A2=10
B2=15
A3=30
B3=20
A4=10
B4=0


a 0 in column B does NOT change the sum and so it must not be ignored.
Try:
=SUMIF(A1:A4,"0",B1:B4)


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional


That did the trick! I was close, but forgot about inserting "". Thanks so much!
  #5   Report Post  
Junior Member
 
Posts: 3
Default

Quote:
Originally Posted by Claus Busch View Post
Hi,

Am Mon, 13 Oct 2014 20:54:07 +0200 schrieb Claus Busch:

=SUMIF(A1:A4,"0",B1:B4)


if there can be values < 0 in column B then try:
=SUMIFS(B1:B4,A1:A4,"0",B1:B4,"0")
or
=SUMPRODUCT(--(A1:A40),--(B1:B40),B1:B4)


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional

Does Excel give us the option to sum amounts in a column based on the amount being greater than 0, and if the cell is highlighted a certain color? For example, if cells A2 and A4 were highlighted, is there a way to add just those two cells from that column?
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
Sum only specific cells based on value in adjacent cell KKD Excel Discussion (Misc queries) 4 May 28th 09 04:18 PM
Conditional formatting based on numerical values of adjacent cells Rardel K Excel Programming 2 March 11th 09 02:07 PM
Calculations based on adjacent cell values Jack Excel Discussion (Misc queries) 4 June 10th 06 02:39 PM
Conditional coloring of Excel cells, based on adjacent cell values? Greg Stuart Excel Worksheet Functions 0 March 10th 06 10:14 PM
Format cell based on adjacent cells values the majestic ferny Excel Programming 4 December 16th 05 06:30 PM


All times are GMT +1. The time now is 12:20 PM.

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

About Us

"It's about Microsoft Excel"