SUM function with an IF statement???

grogzy

New Member
Joined
Jul 9, 2008
Messages
12
Please help, as i've been having loadsa trouble with the following....

I have a cell range which needs to be added up, but if all cells in the renge contain "n/a" then i'd like to display that instead.....can this be done????

thanks in advance!!! :)
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
Question is a little vague but do you mean something like this ?

=IF(COUNT(A1:A10)=0,"N/A",SUM(A1:A10))
 
Upvote 0
YES!!! this is exactly what i was trying to do......thanks lasw10

But now in another cell i need to find the average of the output figure (or if the output is "n/a", then this should be displayed....

can this be done?
 
Upvote 0
Please help, as i've been having loadsa trouble with the following....

I have a cell range which needs to be added up, but if all cells in the renge contain "n/a" then i'd like to display that instead.....can this be done????

thanks in advance!!! :)

What if any of the cells contain #N/A and not the whole range ?

Assuming the range A1:A8, perhaps,

PHP:
=IF(COUNTIF(A2:A8,"#N/A"),"#N/A",SUM(A2:A8))
 
Upvote 0
well assuming the prior formula was returned in say cell B1 you could just use the following in average cell:

=IF($B$1="N/A","N/A",$B$1/COUNT($A$1:$A$10))
 
Upvote 0
try,

Confirm the formula with Ctrl+Shift+Enter and not just Enter:
PHP:
=AVERAGE(IF(A1:A10<>0,A1:A10))
 
Upvote 0
stormseed, you wouldn't need the test of 0, the following (as array) would also work.

=AVERAGE(IF(A1:A10,A1:A10))
 
Upvote 0
well assuming the prior formula was returned in say cell B1 you could just use the following in average cell:

=IF($B$1="N/A","N/A",$B$1/COUNT($A$1:$A$10))

Ok, I never thought about that ! you worked out the next formula considering upon the adjacent cell's output value. Your solution is always precise and clear, Luke. I guess, I have to learn a lot from you as well :p
 
Upvote 0

Forum statistics

Threads
1,214,854
Messages
6,121,941
Members
449,056
Latest member
denissimo

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