Amend SumProduct formula to exclude #N/A values?

Ironman

Well-known Member
Joined
Jan 31, 2004
Messages
1,069
Office Version
  1. 365
Platform
  1. Windows
Hi

I have a row of data with this formula
Excel Formula:
=SUMPRODUCT((ISNUMBER($A$2:$A$257))*(B2:B257=0))

The formula sums all cells in the column containing a zero value. However, this no longer works after formulas were inserted in the sheet resulting in a #N/A value.

Is there any way the above formula can be amended so it ignores the #N/A values please?

Many thanks!
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
A concise example would help. You can post an extract of your sheet with the forum's tool named XL2BB.
What column has the N/A?

Can you edit the formula to show 0 instead of N/A?
 
Last edited:
Upvote 0
Hi Dave, thanks for replying.

The formula value must contain a #N/A value as it's chart-related, to avoid a string of zeros for future values that I don't want to see (which it used to do before the formula changed).

Below is an extract from the sheet. For some reason I get a VB error when I tried to copy as Mini Sheet, so it's a table.

10
RK/3931
YTD AVE0
RK/3931
20
RK/39#N/A
YTD AVE0
RK/39#N/A
30
RK/39#N/A
YTD AVE0
RK/39#N/A
40
RK/39#N/A
YTD AVE0
RK/39#N/A
50
RK/39#N/A
YTD AVE0
RK/39#N/A


The blank green rows are those containing the #N/A formula. They are Rows 3, 5, 8, 10, 13, 15, 18, 20, 23, 25, 28 and so on (you see the pattern), down to row 258.

Hope that helps.
 
Upvote 0
You didn't post the Column and Row information.
Did you post mini sheet?
What result do you expect with the above?
How did you hide the N/As?
 
Last edited:
Upvote 0
Is this what your data is like?
Is your expected answer 4? If not, how did you calculate the expected answer.

SumProduct2022a.xlsm
ABC
1
2104
3RK/3931
4YTD AVE0
5RK/3931
6#N/A
720
8RK/39#N/A
9YTD AVE0
10RK/39#N/A
11#N/A
1230
13RK/39#N/A
14YTD AVE0
15RK/39#N/A
16
1740
18RK/39#N/A
19YTD AVE0
20RK/39#N/A
21
2250
23RK/39#N/A
24YTD AVE0
25RK/39#N/A
7a
Cell Formulas
RangeFormula
C2C2=COUNTIFS(B2:B31,0,A2:A31,">0")
B6,B11,B8B6=VLOOKUP(G6,H3:H6,1,0)
 
Upvote 0
For some reason I get a VB error when I tried to copy as Mini Sheet, so it's a table.

The green cells are those containing the N/A and are hidden using Conditional Formatting.

In your example above, the expected result would be 5, because Rows 2, 7, 12, 17 and 22 all contain zeros.

I'm happy to upload an extract of the sheet if it helps you?
 
Upvote 0
One of the "numbers" was TEXT.
SumProduct2022a.xlsm
ABC
15
210
3RK/3931
4YTD AVE0
5RK/3931
6#N/A
720
8RK/39#N/A
9YTD AVE0
10RK/39#N/A
11#N/A
1230
13RK/39#N/A
14YTD AVE0
15RK/39#N/A
16
1740
18RK/39#N/A
19YTD AVE0
20RK/39#N/A
21
2250
23RK/39#N/A
24YTD AVE0
25RK/39#N/A
7a
Cell Formulas
RangeFormula
C1C1=COUNTIFS(B2:B31,0,A2:A31,">0")
B6,B11,B8B6=VLOOKUP(G6,H3:H6,1,0)
 
Upvote 0
Solution
Thanks Dave - that's brilliant, it works - I love the way you thought that out by looking at the values in Col A >0 as a second condition, which therefore ignored the YTD AVE 0's from the calculation!
 
Upvote 0

Forum statistics

Threads
1,215,064
Messages
6,122,937
Members
449,094
Latest member
teemeren

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