Sum if the cells are not blank for specific products

Goddess

Board Regular
Joined
Dec 3, 2015
Messages
98
Office Version
  1. 2021
Platform
  1. Windows
Hi, I need to sum if only both cells (B & C) are not blank. Some rows are totally blank, as we need to export the data from a system, thus there will be some weird formatting. Example as below

Sheet1:

1620885327590.png


In the example above, I need the result to return in another sheet as below:

Sheet 2:

1620885413060.png

Basically, only sum B & C if both columns have value in them (even if it's 0), and only for specific products as indicated in Sheet 2. Sheet 1 may have other products which I do not need.

Thanks!
Irene
 

Excel Facts

How to total the visible cells?
From the first blank cell below a filtered data set, press Alt+=. Instead of SUM, you will get SUBTOTAL(9,)
Hi, try:
Book1
ABCDEF
1Apple1230Apple123
2Orange1011
3
4Apple233
5Apple234
6Apple4455
7Apple333
8
9Orange345666
10
11Orange456
12Orange333
13Orange33
Sheet1
Cell Formulas
RangeFormula
F1:F2F1=SUMPRODUCT((Sheet1!$A$1:$A$13=E1)*(LEN(Sheet1!$B$1:$B$13)>0)*(LEN(Sheet1!$C$1:$C$13)>0)*(Sheet1!$B$1:$B$13+Sheet1!$C$1:$C$13))
 
Upvote 0
Or this

20210513 Sumifs Simple.xlsx
AB
1Apple123
2Orange1011
Sheet2
Cell Formulas
RangeFormula
B1:B2B1=SUMPRODUCT((Sheet1!$A$1:$A$13=A1)*(Sheet1!$B$1:$B$13<>"")*(Sheet1!$C$1:$C$13<>"")*Sheet1!$B$1:$C$13)
 
Upvote 0
thanks! but not sure why it's not working on my sheet.. result is #Value! hmmm....
 
Upvote 0
Hi,

My formula is more like:

=SUMPRODUCT((Sheet1!$A:$A=$A1)*(Sheet1!$B:$B<>"")*(Sheet1!$C:$C<>"")*Sheet1!$B:$C)
or
=SUMPRODUCT((Sheet1!$A:$A=E1)*(LEN(Sheet1!$B:$B)>0)*(LEN(Sheet1!$C:$C)>0)*(Sheet1!$B:$B+Sheet1!$C:$C))

Is this the reason why it's not working? Btw, between B and C, there's a column. Some with text, most are blanks. So technically, I need to add B & D if both have values, even if it's 0.

Thanks!
 
Upvote 0
ok.. i think i found out the issue here.. there are headers (or titles) in my sheet, as it's exported from a system. Sample as below:


1620901131192.png

It's repeated multiple times in my entire sheet. Anyway to work around it?

Thanks!
 
Upvote 0
ok.. i think i found out the issue here.. there are headers (or titles) in my sheet, as it's exported from a system. Sample as below:


View attachment 38700
It's repeated multiple times in my entire sheet. Anyway to work around it?

Thanks!

That image is quite different to the previous one

1620906113252.png


Can you please give us a sample of the data you want us to use as a basis ?
Ideally in XLBB Format, and if that is not possible Text Table but then advise if it starts in column A or not.
Also if the Sheet name is not Sheet1 what it is, so that you can copy in any formula that someone comes up with.
 
Upvote 0
Hi! Sorry for the confusion. . I didn't realise the headers would cause this issue.

I can't seem to install XL2BB... Below is what Sheet 1 looks like when I export from the system. Basically, the headers (comprise of 2 rows if you notice in column J) is repeated randomly throughout the sheet (more than 1K rows). I only need to sum up H & J if both columns have values in them, even if it's 0, for certain products.

In the example below, I need the result in Sheet 2:

Apple : H6 + J6 = 123
Orange : H23 + J23 = 738
I don't need the result of Pear

ABCDEFGHIJKL
1​
ProductDescriptionNumberOrder #Start DateOrder QtyOutstanding QtyAvailableShortage QtyOTWIQCTotal
2​
(LS0+CT90+VT5)
3​
4​
5​
6​
AppleFS123
435​
1001​
01.02.2021
4.00​
2.00​
123.00
0.00
0​
3,000.00​
7​
500.00​
8​
20,000.00​
9​
AppleFS123
453​
1002​
02.02.2021
9.00​
4.00​
234.00​
10​
AppleFS123
555​
1003​
05.02.2021
4.00​
2.00​
232.00​
11​
AppleFS123
343​
1004​
06.02.2021
3.00​
0.00​
533.00​
12​
AppleFS123
435​
1005​
10.03.2021
6.00​
5.00​
333.00​
13​
AppleFS123
654​
1006​
11.03.2021
8.00​
0.00​
232.00​
14​
AppleFS123
343​
1007​
30.03.2021
5.00​
0.00​
543.00​
15​
AppleFS123
555​
1008​
15.04.2021
12.00​
6.00​
565.00​
16​
AppleFS123
654​
1009​
17.05.2021
33.00​
21.00​
444.00​
17​
18​
Part NameDescriptionNumberOrder #Start DateOrder QtyOutstanding QtyAvailableShortage QtyOTWIQCTotal
19​
(LS0+CT90+VT5)
20​
AppleFS123
654​
1010​
06.02.2021
2.00​
1.00​
765.00​
21​
AppleFS123
344​
1011​
10.03.2021
3.00​
2.00​
443.00​
22​
23​
OrangeFS345
987​
1001​
11.03.2021
5.00​
0.00​
344.00
394.00
0​
700​
24​
3000​
25​
26​
OrangeFS345
789​
1003​
30.03.2021
4.00​
0.00​
334.00​
27​
OrangeFS345
987​
1005​
15.04.2021
66.00​
60.00​
-6.00​
28​
OrangeFS345
666​
1006​
17.05.2021
54.00​
45.00​
-9.00​
29​
0.00​
30​
PearFS567
567​
1004​
07.06.2021
4.00​
2.00​
-2.00​
31​
32​
33​
PearFS567
765​
1006​
07.06.2021
7.00​
3.00​
-4.00​
34​
PearFS567
765​
1008​
14.06.2021
10.00​
5.00​
-5.00​
35​
PearFS567
456​
1010​
14.06.2021
9.00​
0.00​
-9.00​
36​
PearFS567
455​
1011​
14.06.2021
8.00​
5.00​
-3.00​

Thanks!
 
Upvote 0
SumProduct does not like the text sprinkled through the Amount columns, SumIfs is a bit more forgiving.

See if this works for you.
It would have been handy to have the sheet name, I have used a sheet name of Data in my formula.

20210513 Sumifs Simple.xlsx
ABC
1Apple344
2Orange30
3
Result
Cell Formulas
RangeFormula
B1:B2B1=SUMIFS(Data!$H$3:$H$37,Data!$A$3:$A$37,$A1,Data!$H$3:$H$37,"<>",Data!$J$3:$J$37,"<>")+ SUMIFS(Data!$J$3:$J$37,Data!$A$3:$A$37,$A1,Data!$H$3:$H$37,"<>",Data!$J$3:$J$37,"<>")
 
Upvote 0
Solution
Or this

Book1
ABCDEFGHIJKLMNO
1ProductDescriptionNumberOrder #Start DateOrder QtyOutstanding QtyAvailableShortage QtyOTWIQCTotalApple123
2(LS0+CT90+VT5)Orange738
3
4
5
6AppleFS123435100101.02.20214.002.00123.000.0003,000.00
7500.00
820,000.00
9AppleFS123453100202.02.20219.004.00234.00
10AppleFS123555100305.02.20214.002.00232.00
11AppleFS123343100406.02.20213.000.00533.00
12AppleFS123435100510.03.20216.005.00333.00
13AppleFS123654100611.03.20218.000.00232.00
14AppleFS123343100730.03.20215.000.00543.00
15AppleFS123555100815.04.202112.006.00565.00
16AppleFS123654100917.05.202133.0021.00444.00
17
18Part NameDescriptionNumberOrder #Start DateOrder QtyOutstanding QtyAvailableShortage QtyOTWIQCTotal
19(LS0+CT90+VT5)
20AppleFS123654101006.02.20212.001.00765.00
21AppleFS123344101110.03.20213.002.00443.00
22
23OrangeFS345987100111.03.20215.000.00344.00394.000700
243000
25
26OrangeFS345789100330.03.20214.000.00334.00
27OrangeFS345987100515.04.202166.0060.00-6.00
28OrangeFS345666100617.05.202154.0045.00-9.00
290.00
30PearFS567567100407.06.20214.002.00-2.00
31
32
33PearFS567765100607.06.20217.003.00-4.00
34PearFS567765100814.06.202110.005.00-5.00
35PearFS567456101014.06.20219.000.00-9.00
36PearFS567455101114.06.20218.005.00-3.00
Sheet1
Cell Formulas
RangeFormula
O1:O2O1=SUMPRODUCT((Sheet1!$A$1:$A$1999=N1)*(Sheet1!$H$1:$H$1999<>"")*(Sheet1!$J$1:$J$1999<>"")*IFERROR(Sheet1!$H$1:$H$1999+Sheet1!$J$1:$J$1999,0))
 
Upvote 0

Forum statistics

Threads
1,217,053
Messages
6,134,318
Members
449,865
Latest member
dhpaul1031

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