473,398 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

Median Value Question (Different from previous ones)

Hi ppl,

I'm very new to coding in Access and my task now involves finding median values for all Areas, given a table with "Area", "Units Sold" and "Price"

Example:
"Area" "Units Sold" "Price"
California 2 $100,000
California 5 $120,000
California 3 $150,000
New York 7 $70,000
New York 5 $110,000
New York 2 $150,000

I'm trying to find a way to return the following query
"Area" "Median Price"
California $120,000
New York $90,000 (which is $70,000+$110,000 / 2)

Saw some codes which did not have the "Units Sold" field, and my life is complicated by it. Any help would be greatly appreciated.

Thanks,
Ronald
May 31 '07 #1
16 2537
MMcCarthy
14,534 Expert Mod 8TB
Hi ppl,

I'm very new to coding in Access and my task now involves finding median values for all Areas, given a table with "Area", "Units Sold" and "Price"

Example:
"Area" "Units Sold" "Price"
California 2 $100,000
California 5 $120,000
California 3 $150,000
New York 7 $70,000
New York 5 $110,000
New York 2 $150,000

I'm trying to find a way to return the following query
"Area" "Median Price"
California $120,000
New York $90,000 (which is $70,000+$110,000 / 2)

Saw some codes which did not have the "Units Sold" field, and my life is complicated by it. Any help would be greatly appreciated.

Thanks,
Ronald
I don't get why New York is $90,000 as there are three records.

How is Units Sold affecting the Median?

Do you want to find the Median of this ....

"Area" "Price"
California $100,000
California $100,000
California $120,000
California $120,000
California $120,000
California $120,000
California $120,000
California $150,000
California $150,000
California $150,000
Jun 1 '07 #2
I don't get why New York is $90,000 as there are three records.

How is Units Sold affecting the Median?

Do you want to find the Median of this ....

"Area" "Price"
California $100,000
California $100,000
California $120,000
California $120,000
California $120,000
California $120,000
California $120,000
California $150,000
California $150,000
California $150,000
[quote=mmccarthy]I don't get why New York is $90,000 as there are three records.

Hi Mmccarthy, thanks for replying. I saw your post (and Neo's) on a previous find the Median issue. Yes you are right, the "Area" and "Price" for CA you came up with is exactly what I am trying to find, EXCEPT that my data comes in the form which I had typed out earlier (condensed with a Number of Units beside the Price and not expanded out fully).

I know that the previous post had the fully expanded prices but my data doesn't come in that manner and i'm limited by that. So by now, I sure you understand that though there are only 3 records for NY, there are actually close 14 units(i forgot) and the Median is the Price of the 7th (70k) and 8th units (110k) divided by 2, giving us 90k.

Working a little more on my database, I managed to get a column up on the extreme right which has the total number of units for NY and CA so the new table that I have to work with (should make life easier) is

Area Units Price TotalforArea
NY 7 70k 14
NY 5 110k 14
NY 2 130k 14

Thanks, I know I probably have to open a recordset and do a count, but I'm like totally new to Access VBA....Hope to hear your reply!

Ronald
Jun 1 '07 #3
ADezii
8,834 Expert 8TB
Hi ppl,

I'm very new to coding in Access and my task now involves finding median values for all Areas, given a table with "Area", "Units Sold" and "Price"

Example:
"Area" "Units Sold" "Price"
California 2 $100,000
California 5 $120,000
California 3 $150,000
New York 7 $70,000
New York 5 $110,000
New York 2 $150,000

I'm trying to find a way to return the following query
"Area" "Median Price"
California $120,000
New York $90,000 (which is $70,000+$110,000 / 2)

Saw some codes which did not have the "Units Sold" field, and my life is complicated by it. Any help would be greatly appreciated.

Thanks,
Ronald
Assumptions:
  1. Your Table Name is tblValues.
  2. tblValues contains the Fields [Area] (TEXT), [Units Sold] (LONG), [Price] (CURRENCY).
Procedure:
  1. Create a New Query, add tblValues to it, then transfer the SQL Statement below to the SQL View Window. Access will do the rest automatically.
    Expand|Select|Wrap|Line Numbers
    1. SELECT DISTINCT tblValues.Area, fCalculateMedian([Area],[Price]) AS Median
    2. FROM tblValues
    3. ORDER BY tblValues.Area;
  2. Copy the Function Code below to a Standard Code Module.
    Expand|Select|Wrap|Line Numbers
    1. Public Function fCalculateMedian(strArea As String, curPrice As Currency)
    2. Dim MyDB As DAO.Database, MyRS As DAO.Recordset, MySQL As String
    3. Dim intNumOfRecords As Integer, curPriceValue As Currency
    4.  
    5. MySQL = "SELECT tblValues.Area, tblValues.Price FROM tblValues "
    6. MySQL = MySQL & "WHERE tblValues.Area='" & strArea & "' ORDER BY tblValues.Area, tblValues.Price;"
    7.  
    8. Set MyDB = CurrentDb()
    9. Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)
    10.  
    11. MyRS.MoveLast: MyRS.MoveFirst
    12.  
    13. intNumOfRecords = MyRS.RecordCount
    14. If intNumOfRecords = 0 Then Exit Function
    15.  
    16. If intNumOfRecords Mod 2 = 0 Then     'Even number of Records
    17.   MyRS.Move (intNumOfRecords \ 2) - 1   'Move half-way point
    18.     curPriceValue = MyRS![Price]      '1st value to average
    19.   MyRS.MoveNext
    20.     curPriceValue = curPriceValue + MyRS![Price]               '2nd value to average added to 1st value
    21.     fCalculateMedian = Format$(curPriceValue / 2, "Currency")  'Average them out
    22. Else   'Odd number of Records
    23.   MyRS.Move (intNumOfRecords \ 2)
    24.   fCalculateMedian = Format$(MyRS![Price], "Currency")
    25. End If
    26.  
    27. MyRS.Close
    28. End Function
  3. Sample Output is listed below, if you have any problems, let us know.
OUTPUT:
Expand|Select|Wrap|Line Numbers
  1. Area                        Median
  2. California                    $110,000.00
  3. New York                    $115,000.00
  4. Philadelphia                $116,000.00
Jun 1 '07 #4
ADezii
8,834 Expert 8TB
Hi ppl,

I'm very new to coding in Access and my task now involves finding median values for all Areas, given a table with "Area", "Units Sold" and "Price"

Example:
"Area" "Units Sold" "Price"
California 2 $100,000
California 5 $120,000
California 3 $150,000
New York 7 $70,000
New York 5 $110,000
New York 2 $150,000

I'm trying to find a way to return the following query
"Area" "Median Price"
California $120,000
New York $90,000 (which is $70,000+$110,000 / 2)

Saw some codes which did not have the "Units Sold" field, and my life is complicated by it. Any help would be greatly appreciated.

Thanks,
Ronald
Just as a side note, you can use Excel's MEDIAN Function to return a Median value for a Range of Prices.
Jun 2 '07 #5
MMcCarthy
14,534 Expert Mod 8TB
Sorry for the delay in getting back to you. Took me a while to work out the logic on this. I used ADezii's code as a base and this code caters for the Units Sold factor. I've tested it and it worked for me.
Expand|Select|Wrap|Line Numbers
  1.  
  2. Public Function fCalculateMedian(strArea As String) As Currency
  3. Dim MyDB As DAO.Database, MyRS As DAO.Recordset, MySQL As String
  4. Dim intNumUnitsSold As Integer
  5. Dim intRecordNum As Integer
  6. Dim curPriceValue As Currency
  7.  
  8.     MySQL = "SELECT tblValues.[Units Sold], tblValues.Price FROM tblValues "
  9.     MySQL = MySQL & "WHERE tblValues.Area='" & strArea & "' ORDER BY tblValues.Price;"
  10.  
  11.     Set MyDB = CurrentDb()
  12.     Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)
  13.  
  14.     MyRS.MoveFirst
  15.  
  16.     Do Until MyRS.EOF
  17.         intNumUnitsSold = intNumUnitsSold + MyRS![Units Sold]
  18.         MyRS.MoveNext
  19.     Loop
  20.  
  21.     If intNumUnitsSold = 0 Then Exit Function
  22.  
  23.     MyRS.MoveFirst
  24.     If intNumUnitsSold Mod 2 = 0 Then     'Even number of Records
  25.         Do Until MyRS.EOF
  26.             intRecordNum = intRecordNum + MyRS![Units Sold]
  27.             If intRecordNum = (intNumUnitsSold / 2) Then
  28.                 curPriceValue = MyRS![Price]      '1st value to average
  29.                 MyRS.MoveNext
  30.                 curPriceValue = curPriceValue + MyRS![Price]               '2nd value to average added to 1st value
  31.                 fCalculateMedian = Format$(curPriceValue / 2, "Currency")  'Average them out
  32.                 MyRS.MoveLast
  33.             ElseIf intRecordNum > (intNumUnitsSold / 2) Then
  34.                 fCalculateMedian = Format$(MyRS![Price], "Currency")  'Average price
  35.                 MyRS.MoveLast
  36.             End If
  37.             MyRS.MoveNext
  38.         Loop
  39.     Else   'Odd number of Records
  40.         Do Until MyRS.EOF
  41.             intRecordNum = intRecordNum + MyRS![Units Sold]
  42.             If intRecordNum > (intNumUnitsSold / 2) Then
  43.                 fCalculateMedian = Format$(MyRS![Price], "Currency")  'Average price
  44.                 MyRS.MoveLast
  45.             End If
  46.             MyRS.MoveLast
  47.         Loop
  48.     End If
  49.  
  50.     MyRS.Close
  51.     Set MyRS = Nothing
  52.     Set MyDB = Nothing
  53. End Function
  54.  
Jun 2 '07 #6
MMcCarthy
14,534 Expert Mod 8TB
Sorry forgot to add the query which is slightly different from ADezii's

Expand|Select|Wrap|Line Numbers
  1.  
  2. SELECT DISTINCT [tblValues].[Area], fCalculateMedian([Area]) AS Median
  3. FROM tblValues
  4. ORDER BY [tblValues].[Area];
  5.  
Jun 2 '07 #7
Just as a side note, you can use Excel's MEDIAN Function to return a Median value for a Range of Prices.
Hi ADezii, thanks for your help. I've tried following your steps in the code and I got an error reading: "Undefined Function 'fCalculateMedian' in expression" Seems like i'm having trouble adding a user defined function.

I've added it using the method you described:
1) Go to Modules
2) Double click anyone of them
3) Insert Module
4) Copy and paste your Public Function
5) Named the module fCalculateMedian

But the query says it doesnt exist. Anyhelp?

Also I was looking at your code, if I understand the logic, it seems you think the records in the table each correpond to 1 unit sold, and going to the middle of the number of records would work. But actually there are different number of units sold for each price, so it might be that the median value lies in record 30 out of 100 if there are many "Units Sold" in the first few records. This explains why the situation is different from what Excel's median function does, which takes each price as a single occurance. Of cos, perhaps I understood your code wrongly...

But anyhow, if you can help me with getting the new function to work (tells you how new I am to Access programming huh?) I can then give your code a run and tweak it from there. (strangely, the function appears in the expression builder under Functions->MyDatabaseName....)

Thanks for your help thus far, looking forward to your response.

Ronald
Jun 2 '07 #8
MMcCarthy
14,534 Expert Mod 8TB
Hi Ronald

Insert New Module if you haven't already got one or just add my function (which expands ADezii's to cater for the Units sold) by copying and pasting it into any existing module (not a form).

The module does not have to be named fCalculateMedian as this is the name of the function and it doesn't matter which module it is in. In fact naming the module fCalculateMedian is probably confusing Access.

Let me know if you still have problems.

Mary
Jun 2 '07 #9
Hi Ronald

Insert New Module if you haven't already got one or just add my function (which expands ADezii's to cater for the Units sold) by copying and pasting it into any existing module (not a form).

The module does not have to be named fCalculateMedian as this is the name of the function and it doesn't matter which module it is in. In fact naming the module fCalculateMedian is probably confusing Access.

Let me know if you still have problems.

Mary

AMAZING! Thanks Mary! Your code works perfectly. Reading it I see the logic in how you went about it. Thank you so much!!! (This is a really great forum, tons of cool stuff and ppl here)
Jun 2 '07 #10
MMcCarthy
14,534 Expert Mod 8TB
AMAZING! Thanks Mary! Your code works perfectly. Reading it I see the logic in how you went about it. Thank you so much!!! (This is a really great forum, tons of cool stuff and ppl here)
You're welcome Ronald.

Glad you're enjoying the forum.

Mary
Jun 2 '07 #11
Hi, I came across this post and I am trying to do pretty much the same function. In mine, I am trying to find the median of certain values, based on the "Department" grouping. I used ADezii's code and query; I adjusted the code to what I thought should be correct. Unfortunately I encounter an error saying "Data type mistmatch in the criteria"...

This error comes up on this portion of the code " Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)"

Here is the function and the query to what I adjusted them to. If anyone has any ideas because help would be appreciated.

Query:
SELECT DISTINCT Department, fCalculateMedian([Department],[Total_Amount]) AS Median
FROM Gifts
ORDER BY Department;


VBA Code:
Expand|Select|Wrap|Line Numbers
  1. Public Function fCalculateMedian(strArea As String, curPrice As Currency)
  2. Dim MyDB As DAO.Database, MyRS As DAO.Recordset, MySQL As String
  3. Dim intNumOfRecords As Integer, curPriceValue As Currency
  4.  
  5.      MySQL = "SELECT Gifts.Department, Gifts.Total_amount FROM Gifts "
  6.     MySQL = MySQL & "WHERE Gifts.Total_Amount ='" & strArea & "' ORDER BY Gifts.Department, Gifts.Total_Amount;"
  7.  
  8.     Set MyDB = CurrentDb()
  9.     Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)
  10.  
  11.     MyRS.MoveLast: MyRS.MoveFirst
  12.  
  13.     intNumOfRecords = MyRS.RecordCount
  14.     If intNumOfRecords = 0 Then Exit Function
  15.  
  16.     If intNumOfRecords Mod 2 = 0 Then     'Even number of Records
  17.       MyRS.Move (intNumOfRecords \ 2) - 1   'Move half-way point
  18.         curPriceValue = MyRS![Price]      '1st value to average
  19.       MyRS.MoveNext
  20.         curPriceValue = curPriceValue + MyRS![Price]               '2nd value to average added to 1st value
  21.         fCalculateMedian = Format$(curPriceValue / 2, "Currency")  'Average them out
  22.     Else   'Odd number of Records
  23.       MyRS.Move (intNumOfRecords \ 2)
  24.       fCalculateMedian = Format$(MyRS![Price], "Currency")
  25.     End If
  26.  
  27.     MyRS.Close
  28.  
  29. End Function
Apr 15 '08 #12
ADezii
8,834 Expert 8TB
Hi, I came across this post and I am trying to do pretty much the same function. In mine, I am trying to find the median of certain values, based on the "Department" grouping. I used ADezii's code and query; I adjusted the code to what I thought should be correct. Unfortunately I encounter an error saying "Data type mistmatch in the criteria"...

This error comes up on this portion of the code " Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)"

Here is the function and the query to what I adjusted them to. If anyone has any ideas because help would be appreciated.

Query:
SELECT DISTINCT Department, fCalculateMedian([Department],[Total_Amount]) AS Median
FROM Gifts
ORDER BY Department;


VBA Code:
Expand|Select|Wrap|Line Numbers
  1. Public Function fCalculateMedian(strArea As String, curPrice As Currency)
  2. Dim MyDB As DAO.Database, MyRS As DAO.Recordset, MySQL As String
  3. Dim intNumOfRecords As Integer, curPriceValue As Currency
  4.  
  5.      MySQL = "SELECT Gifts.Department, Gifts.Total_amount FROM Gifts "
  6.     MySQL = MySQL & "WHERE Gifts.Total_Amount ='" & strArea & "' ORDER BY Gifts.Department, Gifts.Total_Amount;"
  7.  
  8.     Set MyDB = CurrentDb()
  9.     Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)
  10.  
  11.     MyRS.MoveLast: MyRS.MoveFirst
  12.  
  13.     intNumOfRecords = MyRS.RecordCount
  14.     If intNumOfRecords = 0 Then Exit Function
  15.  
  16.     If intNumOfRecords Mod 2 = 0 Then     'Even number of Records
  17.       MyRS.Move (intNumOfRecords \ 2) - 1   'Move half-way point
  18.         curPriceValue = MyRS![Price]      '1st value to average
  19.       MyRS.MoveNext
  20.         curPriceValue = curPriceValue + MyRS![Price]               '2nd value to average added to 1st value
  21.         fCalculateMedian = Format$(curPriceValue / 2, "Currency")  'Average them out
  22.     Else   'Odd number of Records
  23.       MyRS.Move (intNumOfRecords \ 2)
  24.       fCalculateMedian = Format$(MyRS![Price], "Currency")
  25.     End If
  26.  
  27.     MyRS.Close
  28.  
  29. End Function
The mistake is in Line #6, but the actual Error occurs when you try to Open the Recordset based on MySQL. It appears as though, in your WHERE Clause, you are attempting to equate a Currency Value (Gifts.Total_Amount) with a String Value (strArea). Therein lies your mismatch.
Expand|Select|Wrap|Line Numbers
  1. MySQL = MySQL & "WHERE Gifts.Total_Amount ='" & strArea & "' ORDER BY 
Apr 15 '08 #13
I followed your advice and adjusted the MYSQL, as well as a few other problems I found and now it gets past the part where I was originally having the problem. Now it is getting stuck on the code on line 19:

curPriceValue = MyRS![Price]

Because I am new to using VBA with Access, I am unsure what the ![Price] does. So it is hard for me to figure out a solution. The error I am receiving says:

Run-tim error '3265':
Item not found in this collection.


I don't know if the problem could be the version of Access that I am using, I am using Access 2003. I thought maybe the function of ![Price] is not available with my version of Access.




Incase it is needed, here is an updated version of my code:

Expand|Select|Wrap|Line Numbers
  1. Public Function fCalculateMedian(strArea As Long, curPrice As Currency)
  2. Dim MyDB As DAO.Database, MyRS As DAO.Recordset, MySQL As String
  3. Dim intNumOfRecords As Integer, curPriceValue As Currency
  4.  
  5.      MySQL = "SELECT Gifts.Department, Gifts.Total_amount FROM Gifts "
  6.     MySQL = MySQL & "WHERE Gifts.Department =" & strArea & " ORDER BY Gifts.Department, Gifts.Total_Amount;"
  7.  
  8.     Set MyDB = CurrentDb()
  9.     Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)
  10.  
  11.     MyRS.MoveLast: MyRS.MoveFirst
  12.  
  13.     intNumOfRecords = MyRS.RecordCount
  14.     If intNumOfRecords = 0 Then Exit Function
  15.  
  16.     If intNumOfRecords Mod 2 = 0 Then     'Even number of Records
  17.       MyRS.Move (intNumOfRecords \ 2) - 1   'Move half-way point
  18.  
  19.             curPriceValue = MyRS![Price]      '1st value to average
  20.  
  21.       MyRS.MoveNext
  22.         curPriceValue = curPriceValue + MyRS![Price]               '2nd value to average added to 1st value
  23.         fCalculateMedian = Format$(curPriceValue / 2, "Currency")  'Average them out
  24.     Else   'Odd number of Records
  25.       MyRS.Move (intNumOfRecords \ 2)
  26.       fCalculateMedian = Format$(MyRS![Price], "Currency")
  27.     End If
  28.  
  29.     MyRS.Close
  30.  
  31. End Function

Thanks for your help,
-Jedd
Apr 16 '08 #14
Stewart Ross
2,545 Expert Mod 2GB
...curPriceValue = MyRS![Price]
...
Run-tim error '3265':
Item not found in this collection.
Hi. This error is nothing to do with the version of Access; it simply means that you do not have a field called Price in the recordset you are looping through.

The general syntax of assigning values to variables from field references in a recordset is like this:
Expand|Select|Wrap|Line Numbers
  1. somevar = RecordsetVar![some field name]
Remember that you have to adjust the code that was originally written for another user with a different problem for your particular circumstances, and if you don't have a field named Price you either need to remove the field reference from the loop or substitute one that is named correctly for your data.

You also need to understand what it is that the function is doing before you can adapt it, and at present I don't think you do...

**Edit: The whole purpose of the function as provided is to calculate the median of the Price. If you are computing the median of a different value you must substitute all occurrences of Price in the code with the actual field name in your own application.

-Stewart
Apr 16 '08 #15
This took me so long to post on here because I haven't been able to try it. I was out from work for a few days with pneumonia... Anyways I now understand that ![price] just extracts the price column information from the recordset, I was just unfamiliar with it.

I have run into quite a few problems and every time I go to post on here what it is, I figure out the problem. Finallry the results are correct. I really appreciate all of your help. I would not have been able to do this without all of you.


-Jedd
Apr 22 '08 #16
ADezii
8,834 Expert 8TB
This took me so long to post on here because I haven't been able to try it. I was out from work for a few days with pneumonia... Anyways I now understand that ![price] just extracts the price column information from the recordset, I was just unfamiliar with it.

I finally ran the query and it looked as though it was working. Upon analyzing the results are not correct. It is not delivering the median. What it is doing is if there are two values that are the same it only counts them once. So in the example below it only appears to think there are 5 records and will give a median of 36000 because that is the median of all the distinct prices. I will try to figure out how to fix this, but I think that may be over my skill level, so help would be appreciated.

Here is one example of the problem, This is where the data is coming from:

GEO Total_Amount
BLT 58,908.47
BLT 49,950.56
BLT 36,000.00
BLT 25,000.00
BLT 25,000.00
BLT 25,000.00
BLT 25,000.00
BLT 25,000.00
BLT 25,000.00
BLT 24,934.64

The result is:
Median GEO
$36,000.00 BLT


Here is my code:

Expand|Select|Wrap|Line Numbers
  1.  Public Function fCalculateMedian2(strArea As String, curPrice As Currency)
  2. Dim MyDB As DAO.Database, MyRS As DAO.Recordset, MySQL As String
  3. Dim intNumOfRecords As Integer, curPriceValue As Currency
  4.  
  5. MySQL = "SELECT test.geo, test.Total_Amount FROM test "
  6. MySQL = MySQL & "WHERE test.geo= '" & strArea & "' group BY test.geo, test.Total_Amount;"
  7.  
  8.  Set MyDB = CurrentDb()
  9. Set MyRS = MyDB.OpenRecordset(MySQL, dbOpenSnapshot)
  10.  
  11. MyRS.MoveLast: MyRS.MoveFirst
  12.  
  13. intNumOfRecords = MyRS.RecordCount
  14. If intNumOfRecords = 0 Then Exit Function
  15.  
  16. If intNumOfRecords Mod 2 = 0 Then     'Even number of Records
  17.   MyRS.Move (intNumOfRecords \ 2) - 1   'Move half-way point
  18.     curPriceValue = MyRS![Total_Amount]      '1st value to average
  19.   MyRS.MoveNext
  20.     curPriceValue = curPriceValue + MyRS![Total_Amount]               '2nd value to average added to 1st value
  21.     fCalculateMedian2 = Format$(curPriceValue / 2, "Currency")  'Average them out
  22. Else   'Odd number of Records
  23.   MyRS.Move (intNumOfRecords \ 2)
  24.   fCalculateMedian2 = Format$(MyRS![Total_Amount], "Currency")
  25. End If
  26.  
  27. MyRS.Close
  28. End Function
  29.  
  30.  


-Jedd
The results are correct since you applied a GROUP BY Clause whai would have the same effect as passing the following data to the Function:
Expand|Select|Wrap|Line Numbers
  1. GEO      Total_Amount
  2. BLT      24,934.64
  3. BLT      25,000.00
  4. BLT      36,000.00
  5. BLT      49,950.56
  6. BLT      58,908.47
As you can see, jedgretzky, the Median Value is exactly what it should be, namely $36,000/BLT
Apr 22 '08 #17

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Ross Contino | last post by:
Hello to all: I have been searching the web for examples on how to determine a median value in a mySQL table. I have reviewed the article at...
2
by: Bob | last post by:
I have been looking at the code for MedianFind(pDte As String) from the following thread from UtterAccess.com: "Finding Median average grouped by field" I have been able to get it to run using...
8
by: nick.vitone | last post by:
Hi, I'm somewhat of a novice at Access, and I have no experience programming whatsoever. I'm attempting to calculate the statistical median in a query. I need to "Group by" one column and find...
0
by: jimfortune | last post by:
In http://groups-beta.google.com/group/comp.databases.ms-access/msg/46197725b88fc3fd?hl=en I said: If qryRankForMedian is changed to select only values within a group (along with a suitable...
4
by: uspensky | last post by:
I have a table (cars) with 3 fields: VIN, Class, sell_price 101, sports, 10000 102, sports, 11000 103, luxury, 9000 104, sports, 11000 105, sports, 11000 106, luxury, 5000 107, sports, 11000
5
by: jonm4102 | last post by:
I'm trying to calculate the median of some numerical data. The data can only be found in a query (henceforth query 1) field I previously made, and I would prefer to calculate the median in a new...
0
by: Sebastien.LICHTHERTE | last post by:
Hello, I need to calculate the median and percentile of values in a group by query satisfying several criteria the user is asked to fill in when opening the query. A have a table called RX with...
3
by: mehwishobaid | last post by:
i dont know wat is wrong with my code. when i compile. i get the error saying line 29: error: expression must have pointer-to-object type #include <iostream> using namespace std; #include...
6
by: rrstudio2 | last post by:
I am using the following vba code to calculate the median of a table in MS Access: Public Function MedianOfRst(RstName As String, fldName As String) As Double 'This function will calculate the...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.