AVERAGE when some cells contain text

slam

Well-known Member
Joined
Sep 16, 2002
Messages
921
Office Version
  1. 365
  2. 2019
I’m having a hard time dealing with an AVERAGE. If B3 is blank, I need “” displayed, otherwise I need it to calculate the average of E3:W3. The problem I’m having is that there is sometimes text in E3:W3. I still want it to include those cells in the average and assume they are 0. How do I go about this? Currently I'm just getting an error.
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
If cells in E3:W3 are blank, do you want to count those as 0 as well?

If so:

=IF(B3="","",SUM(E3:W3)/19)

If not:

=IF(B3="","",SUM(E3:W3)/COUNTA(E3:W3))
 
Upvote 0
If cells in E3:W3 are blank, do you want to count those as 0 as well?

If so:

=IF(B3="","",SUM(E3:W3)/19)

If not:

=IF(B3="","",SUM(E3:W3)/COUNTA(E3:W3))

The answer would be no, but both those formulas give me the same result. I should have mentioned that the cells in the range E3:W3 contain a formula, so when they're blank, they actually contain "".
 
Upvote 0
you could also do
=if(iserror(sum(e3:w3),"",if(sum(e3:w3)=0,"",sum(e3:w3)))

you might need parantheses around the 0 but not sure
 
Upvote 0
EDIT: Hmmm, not showing 0 for rows that contain text and no numeric values actually
 
Upvote 0
If it helps, the text can only be DNS or DNF (or "" I suppose is considered text too)
 
Upvote 0
=if(b3="","",sum(e3:w3)/max(1,count(e3:w3)+sum(countif(e3:w3,{"dns","dnf"}))))
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,833
Members
452,947
Latest member
Gerry_F

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