Results 1 to 6 of 6
  1. #1
    Richey1977 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Posts
    3

    Replicating and Excel INDEX - MATCH with DLOOKUP

    Hi. First-time poster. I’m hoping someone can help.



    I have built a results database for my running club in Microsoft Excel. It works pretty well, and I’ve got it to perform all sorts of functions – club records, personal best etc. Fairly easy stuff. With some reference to forums like this, I then used the INDEX and MATCH functions to provide an ‘age-graded’ scores, by looking up data from two axis points on a separate table.

    I’d like to convert my excel workbook to Access now – because there are thousands of records, and I’m finding Excel a bit unstable, and it’s less practical to use when there is so much data on the screen. I’ve replicated everything, but I can’t do the INDEX and MATCH lookup on Access.

    Here’s the scenario:

    Every runner’s race result is listed in records which identify the runner’s name, date, event, distance, and finishing time. A bunch of lookups then fetch the runner’s gender and age on the date of the event (in this example male of 38 run a 10k race). The INDEX and MATCH is then used to look at a table of world records for each gender, age and distance, and then return a score based on the percentage of the world record that was achieved by our runner (so the WR for a 38y-o male over 10k is 28:00. Our man did it in 38:18, so it returns a score of 73.11%

    These age-graded percentages are vital to us because we can than assess ourselves against this single criteria, which equalises the athletic differences of age and gender.

    Can someone give me a head start on this (excuse the pun)? I think I need to use the DLOOKUP function, but as far as I can see, the DLOOKUP function requires definite fields in the lookup array to work – whereas the ‘distance’ field to lookup will vary in each case, depending on the type of race that was completed… so I can’t get this to work.
    Click image for larger version. 

Name:	Picture1.jpg 
Views:	19 
Size:	105.1 KB 
ID:	20790
    Attached Thumbnails Attached Thumbnails AGExample.gif  

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,526
    The excel layout vs normalized db wont be the same.
    In acccess you'll have table:

    tRace
    ----------
    RaceID
    RaceName
    place
    RaceDate
    Distance

    tRaceDtls
    -----------------
    RaceID
    Gender
    Time
    Age

    tRecords
    --------------
    RaceID
    Age
    Distance
    Time

    tRunner
    ---------
    Name
    BirthDate
    Gender

    tRunnerRaces
    -----------------
    RaceID
    time

    THEN you can build links to races/records etc.

  3. #3
    Richey1977 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Posts
    3
    Hi - Thank you - I've already done all that. What I need is lookup a table of world record standards, where the age is the X axis, and distance is the Y axis - obviously the age and distance will match those in the race results record.

  4. #4
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    Did you try a query that joins tables on the Age fields? What about gender? Don't see that field in WorldRecords. That would mean a compound link in query on two fields.

    If you want to use DLookup dynamically, the values in Distance field would have to equate to field names in WorldRecords.

    DLookup("[" & [Distance] & "]", "WorldRecords", "Age=" & [Age at event] & " AND Gender='" & [Gender] & "'")

    Be aware domain aggregates can be slow performers in queries and textboxes. Table/query join would be better.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

  5. #5
    Richey1977 is offline Novice
    Windows 7 64bit Access 2007
    Join Date
    May 2015
    Posts
    3
    Quote Originally Posted by June7 View Post
    Did you try a query that joins tables on the Age fields? What about gender? Don't see that field in WorldRecords. That would mean a compound link in query on two fields.

    If you want to use DLookup dynamically, the values in Distance field would have to equate to field names in WorldRecords.

    DLookup("[" & [Distance] & "]", "WorldRecords", "Age=" & [Age at event] & " AND Gender='" & [Gender] & "'")

    Be aware domain aggregates can be slow performers in queries and textboxes. Table/query join would be better.
    Thank you, June7. There are two tables of records to seperate the genders. My plan (carried over from Excel) was to wrap the whole lot if an IIF function to seperate them.

    I'll give this a try - thank you.

  6. #6
    June7's Avatar
    June7 is offline VIP
    Windows 7 64bit Access 2010 32bit
    Join Date
    May 2011
    Location
    The Great Land
    Posts
    52,963
    The records should be in one table with another field for gender.
    How to attach file: http://www.accessforums.net/showthread.php?t=70301 To provide db: copy, remove confidential data, run compact & repair, zip w/Windows Compression.

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

Similar Threads

  1. Use Excel like Choose & Match
    By crimedog in forum Reports
    Replies: 2
    Last Post: 04-10-2015, 12:47 PM
  2. Index Match question
    By praetorianprefect in forum Queries
    Replies: 5
    Last Post: 10-07-2013, 09:40 PM
  3. Replies: 1
    Last Post: 09-30-2012, 07:03 AM
  4. Choose match index in access
    By dastr in forum Access
    Replies: 1
    Last Post: 03-19-2012, 03:36 PM
  5. Dlookup to match two criteria and return value
    By randolphoralph in forum Programming
    Replies: 20
    Last Post: 05-20-2010, 12:27 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