+ Reply to Thread
Results 1 to 5 of 5

Don't get database functions

  1. #1
    Registered User
    Join Date
    02-27-2008
    Location
    Irving, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    96

    Don't get database functions

    Hi all,

    I've got a List of project hours booked on Sheet1, and a summary List by project on Sheet2. For each project, I want to have a cell on the summary sheet that gives the latest date with hours for that job. So, if Sheet1 has ProjectA with some dates and hours, ProjectB w/ dates and hours, etc, and the summary Sheet2 has one row for ProjectA, one for ProjectB, etc, how do I use the dmax() function to get the latest date for a given project? Or, is that even the right way to do it?

    Thanks in advance if anyone can clear this up for me!

    -Adam
    -Adam Hartman
    Mechanical Engineer

  2. #2
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Don't get database functions

    I don't use the Dx functions that much myself - I'm sure you can use them but if you have a lot of projects the layout might not be great (I think [offhand] you would need field header above each Project name)

    You could potentially use LOOKUP depending on whether the records are sorted ?

    If the Sheet1 transactions are listed such that the last recorded instance of a given project is the Max date then if we assume:

    Sheet1!A1:A100 contains Projects, B contains date & C hours
    Sheet2!A2 contains project of interest

    then

    Sheet2!B2 - "last date"
    =LOOKUP(2,1/(Sheet1!$A$1:$A$100=$A2),Sheet1!B$1:B$100)

    Sheet2!C2 - "last hours"
    =LOOKUP(2,1/(Sheet1!$A$1:$A$100=$A2),Sheet1!C$1:C$100)
    (ie as above but altered result vector - B formula can be copied across)

    If the above assumption regards data on Sheet1 does not hold true then other alternatives would generally be Array based and even less efficient (assuming you opt against DMAX).

    (edit: you might also get away with a Pivot Table but that may / may not be viable for you - unknown)
    Last edited by DonkeyOte; 02-26-2010 at 03:52 PM. Reason: stated Sheet A rather than Sheet1

  3. #3
    Forum Contributor
    Join Date
    02-25-2010
    Location
    Boston
    MS-Off Ver
    Excel 2007
    Posts
    174

    Re: Don't get database functions

    The above poster is correct, DB functions are very annoying in excel. They require you to set up a conditional array of cells and list the Column Headers of every condition as well as a proper boolean logic function.

    Most figures can be derived elsewise. If you need more help post examples and we will work out some useful formulas.

    (the big reason the D* formulas don't do much is because all conditions can be written just as easily in an IF() statement. With a little creativity you never need to use anythign else when thinking conditionally.)

  4. #4
    Registered User
    Join Date
    02-27-2008
    Location
    Irving, Texas
    MS-Off Ver
    MS Office 2016
    Posts
    96

    Re: Don't get database functions

    Thanks for the tip, DonkeyOte! Your code worked wonderfully. What's the 1/(...) stuff all about?

  5. #5
    Forum Guru DonkeyOte's Avatar
    Join Date
    10-22-2008
    Location
    Northumberland, UK
    MS-Off Ver
    O365
    Posts
    21,531

    Re: Don't get database functions

    Quote Originally Posted by ahartman
    What's the 1/(...) stuff all about?
    see: http://www.excelforum.com/2252293-post5.html (and link within)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1