Results 1 to 2 of 2
  1. #1
    yes sir is offline Competent Performer
    Windows Vista Access 2007
    Join Date
    Aug 2010
    Posts
    159

    How to do %'s of data?

    I am having the hardest time trying to find out how to do percentages in Access.

    Here is what I have:



    Table1 with columns
    Code:
    EventID, PlayerID, FGM, FGA
    1,     1, 2, 5
    2,     1, 1, 5
    3,     1, 4, 5
    4,     2, 3, 10
    5,     1, 4, 10
    (Don't know how to add columns to make that table look better)

    Basically I want to group all of the records with the same PlayerID and sum the FGM and the FGA and then divide these two totals to get a %.

    So for example, PlayerID = 1. Then the Sum(FGM)/Sum(FGA) = 11/25 = 44%.

    I even want to get a little crazy with this concept to and add commands to limit this percentage to include the five most recent EventIDs and the 10 most recent EventIDs for each PlayerID. So instead of having a percentage for every record that has the same PlayerID, I want to limit it based on a given range.

    If anyone can point me in the right direction, then I would like to try some of this on my own.

    Thanks

  2. #2
    ajetrumpet is offline VIP
    Windows Vista Access 2007
    Join Date
    Mar 2010
    Location
    N/A
    Posts
    2,694
    Code:
    select playerid, sum([fgm]) as fgmsum, sum([fga]) as fgasum, 
    
    format(cdbl(fgmsum/fgasum), "##0.00%") AS NewField
    
    FROM table
    
    GROUP BY playerid

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 4
    Last Post: 01-05-2011, 07:56 AM
  2. Find data, load data, and save as a new record
    By hawzmolly in forum Access
    Replies: 0
    Last Post: 10-05-2008, 03:18 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums