Special average calculation

  • Thread starter Thread starter Andrew Bourke
  • Start date Start date
A

Andrew Bourke

Hi
I would like to calculate the average of a list of numbers such as
45, 56e, 67, 32.
The e in 56e is important because it indicates an estimated score.

I could write a macro to strip the e away first, but I was wondering if
there was a simpler way to handle this, such as a VBA function or a
worksheet function ?

=AverageA doesn't seem to do it.

TIA

Andrew
 
=SUM(IF(A1:A10<>"",--SUBSTITUTE(A1:A10,"e","")))

this is an array formula, so commit with Ctrl-Shift-Enter

--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 
Very nice.
Can this be put easily into a VBA macro ?
Rather than leave formulas in cells on the sheet I would like to do the
calculations through a macro.

TIA
Andrew
 
As an array formula you need to evaluate it, like so

Range("A1").Value =
Activesheet.Evaluate("=SUM(IF(A1:A10<>"""",--SUBSTITUTE(A1:A10,""e"","""")))")


--
---
HTH

Bob


(there's no email, no snail mail, but somewhere should be gmail in my addy)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top