By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,392 Members | 1,576 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,392 IT Pros & Developers. It's quick & easy.

Average by .25

P: n/a
I know there is an equation to come up with this but I can't think of
it.

I have to enter 3 different measurements an example below:

15.25
15.25
15.00

I need this to return the average of the three like this 15.25

I used the following but I get the average of the sum:

([ab1] + [ab2] + [ab3])/3 this will equal 15.17

I need it to return 15.25 It's probably a min/max function but I need
some help

Thanks

Nov 13 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Are you trying to find the Median (value of the middle item in the list) or
the Mode (the value that repeats most often)?

--
Wayne Morgan
MS Access MVP
<dm******@hotmail.com> wrote in message
news:11**********************@o13g2000cwo.googlegr oups.com...
I know there is an equation to come up with this but I can't think of
it.

I have to enter 3 different measurements an example below:

15.25
15.25
15.00

I need this to return the average of the three like this 15.25

I used the following but I get the average of the sum:

([ab1] + [ab2] + [ab3])/3 this will equal 15.17

I need it to return 15.25 It's probably a min/max function but I need
some help

Thanks

Nov 13 '05 #2

P: n/a
There's some great stuff in this NG if you search for it...

original post:
This should do it, just put .50 as the ToWhat parameter.

Function RoundIt (RoundMe,ToWhat)
RoundIt = (Int(RoundMe / ToWhat + .5) * ToWhat)
End Function

Ron Knapper
Newsgroups: comp.databases.ms-access
From: r...@aol.com (Ron R K)
Date: 1996/01/30
Subject: Re: Rounding a dollar value

Nov 13 '05 #3

P: n/a
Thanks all I already found it.

Function RoundToNearest(dblNumber As Double, varRoundAmount As Double,
_
Optional varUp As Variant) As Double

Dim dblTemp As Double
Dim lngTemp As Long

dblTemp = dblNumber / varRoundAmount
lngTemp = CLng(dblTemp)

If lngTemp = dblTemp Then
RoundToNearest = dblNumber
Else
If IsMissing(varUp) Then
' round down
dblTemp = lngTemp
Else
' round up
dblTemp = lngTemp + 1
End If
RoundToNearest = dblTemp * varRoundAmount
End If
End Function
I call it in a function from a query. Thanks again

Nov 13 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.