Challenge: Sum cells in one column when adjacent cells are not blank

losamfr17

Board Regular
Joined
Jun 10, 2016
Messages
149
Good morning,

My goal is to sum cells in column 2018 only when there are non blank adjacent cells in in column 2019.
Can you think of a formula to do that? Do I need to create a new formula in VBA?

Thank you in advance.

[TABLE="width: 500"]
<tbody>[TR]
[TD]Day[/TD]
[TD]2019[/TD]
[TD]2018[/TD]
[TD]% Chg[/TD]
[/TR]
[TR]
[TD]Mon[/TD]
[TD]50[/TD]
[TD]40[/TD]
[TD]25%[/TD]
[/TR]
[TR]
[TD]Tue
[/TD]
[TD]50[/TD]
[TD]40[/TD]
[TD]25%[/TD]
[/TR]
[TR]
[TD]Wed[/TD]
[TD]50[/TD]
[TD]40[/TD]
[TD]25%[/TD]
[/TR]
[TR]
[TD]Thu[/TD]
[TD][/TD]
[TD]40[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Fri[/TD]
[TD][/TD]
[TD]40[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sat[/TD]
[TD][/TD]
[TD]40[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sun[/TD]
[TD][/TD]
[TD]40[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Cum Total Week 1[/TD]
[TD]150[/TD]
[TD]120[/TD]
[TD]25%[/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Why does 9 mean SUM in SUBTOTAL?
It is because Sum is the 9th alphabetically in Average, Count, CountA, Max, Min, Product, StDev.S, StDev.P, Sum, VAR.S, VAR.P.
[TABLE="class: grid"]
<tbody>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[TD]
C
[/TD]
[TD]
D
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]Day[/TD]
[TD]
2019​
[/TD]
[TD]
2018​
[/TD]
[TD]% Chg[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]Mon[/TD]
[TD]
50​
[/TD]
[TD]
40​
[/TD]
[TD]
0.25​
[/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]Tue[/TD]
[TD]
50​
[/TD]
[TD]
40​
[/TD]
[TD]
0.25​
[/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD]Wed[/TD]
[TD]
50​
[/TD]
[TD]
40​
[/TD]
[TD]
0.25​
[/TD]
[/TR]
[TR]
[TD]
5
[/TD]
[TD]Thu[/TD]
[TD][/TD]
[TD]
40​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
6
[/TD]
[TD]Fri[/TD]
[TD][/TD]
[TD]
40​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
7
[/TD]
[TD]Sat[/TD]
[TD][/TD]
[TD]
40​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
8
[/TD]
[TD]Sun[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
9
[/TD]
[TD]Cum Total Week 1[/TD]
[TD]
150​
[/TD]
[TD]
120​
[/TD]
[TD]
0.25​
[/TD]
[/TR]
</tbody>[/TABLE]

B9
=SUMIFS(B2:B8,C2:C8,"<>")

 
Last edited:
Upvote 0
[TABLE="class: grid"]
<tbody>[TR]
[TD][/TD]
[TD]
A
[/TD]
[TD]
B
[/TD]
[TD]
C
[/TD]
[TD]
D
[/TD]
[/TR]
[TR]
[TD]
1
[/TD]
[TD]Day[/TD]
[TD]
2019​
[/TD]
[TD]
2018​
[/TD]
[TD]% Chg[/TD]
[/TR]
[TR]
[TD]
2
[/TD]
[TD]Mon[/TD]
[TD]
50​
[/TD]
[TD]
40​
[/TD]
[TD]
0.25​
[/TD]
[/TR]
[TR]
[TD]
3
[/TD]
[TD]Tue[/TD]
[TD]
50​
[/TD]
[TD]
40​
[/TD]
[TD]
0.25​
[/TD]
[/TR]
[TR]
[TD]
4
[/TD]
[TD]Wed[/TD]
[TD]
50​
[/TD]
[TD]
40​
[/TD]
[TD]
0.25​
[/TD]
[/TR]
[TR]
[TD]
5
[/TD]
[TD]Thu[/TD]
[TD][/TD]
[TD]
40​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
6
[/TD]
[TD]Fri[/TD]
[TD][/TD]
[TD]
40​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
7
[/TD]
[TD]Sat[/TD]
[TD][/TD]
[TD]
40​
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
8
[/TD]
[TD]Sun[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]
9
[/TD]
[TD]Cum Total Week 1[/TD]
[TD]
150​
[/TD]
[TD]
120​
[/TD]
[TD]
0.25​
[/TD]
[/TR]
</tbody>[/TABLE]

B9
=SUMIFS(B2:B8,C2:C8,"<>")


Then just switch the ranges for columns C
C9=SUMIFS(C2:C8,B2:B8,"<>")
 
Upvote 0

Forum statistics

Threads
1,223,214
Messages
6,170,774
Members
452,353
Latest member
strainu

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