Average with non-numeric characters and blanks in range (?)

bhodgman

New Member
Joined
Dec 31, 2016
Messages
7
Need help with a formula for the average of the following range, ignoring the blanks and text cells ('DNP' and 'NA'), but treating any number preceded by a '^' as that number:

<table cellspacing="0" cellpadding="0" dir="ltr" border="1" fixed;="" font-family:="" arial,="" sans,="" sans-serif;="" border-collapse:="" collapse;="" border:="" 1px="" solid="" rgb(204,="" 204,="" 204);"="" width=""><colgroup><col style="width: 100px;"></colgroup><tbody>[TR]
[TD="align: right"]NA[/TD]
[/TR]
[TR]
[TD="align: right"]^4[/TD]
[/TR]
[TR]
[TD="align: right"]DNP[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]5[/TD]
[/TR]
[TR]
[TD][/TD]
[/TR]
[TR]
[TD="align: right"]NA[/TD]
[/TR]
[TR]
[TD="align: right"]2[/TD]
[/TR]
[TR]
[TD="align: right"]^1[/TD]
[/TR]
</tbody></table>

So formula for average of the above would return an answer of '3' - (4+5+2+1 / these four values =3).

Thoughts? I think it needs to be array entered with some combination of SUBSTITUTE and ISNUMBER, but I just can't figure out the syntax... Thanks!!!
 

Excel Facts

Create a Pivot Table on a Map
If your data has zip codes, postal codes, or city names, select the data and use Insert, 3D Map. (Found to right of chart icons).
Hmmm.... I'm actually using Google Sheets, and now noticed that if the blank cells are filled with some text, the formula seems to returns the correct value...

I thought the syntax between Google Sheets and Excel was essentially identical... but perhaps not... ugghh....

Are the 'blank' cells really blank or the result of a formula? If the latter, get the formula to return a single blank " " instead of "" and it will work in Google Sheets.
 
Upvote 0
Hmmm.... I'm actually using Google Sheets, and now noticed that if the blank cells are filled with some text, the formula seems to returns the correct value...

I thought the syntax between Google Sheets and Excel was essentially identical... but perhaps not... ugghh....

Google Sheets has an issue with processing of empty/blanks cells... So try the following instead:

=arrayformula(AVERAGE(IF(1-(A2:A8=""),IF(ISNUMBER(SUBSTITUTE(A2:A8,"^","",1)+0),SUBSTITUTE(A2:A8,"^","",1)+0))))
 
Last edited:
Upvote 0
That results in this in Google Sheets:

<style type="text/css"><!--td {border: 1px solid #ccc;}br {mso-data-placement:same-cell;}--></style>
NA3.666666667
^4
DNP
5
NA
2
^1

<tbody>
</tbody>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,786
Messages
6,121,546
Members
449,038
Latest member
Guest1337

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