Ask Your Question
0

So close to DMAX solution... [closed]

asked 2015-07-28 18:21:10 +0200

joshuaos gravatar image

updated 2015-10-24 01:20:59 +0200

Okay, so I'm on LibreOffice Calc 4.2.8.2 in English...

I've got one very simple sheet that is to be a 'review_log'... with two columns and data entered...

Date          | Who
4/12/13    |   Joshua
4/12/14    |   Joshua
4/12/15    |   Joshua
3/2/15      |   James

Etcetera, with names and dates entered forever and the list getting longer.

On another sheet, I enter in the first column just the name, in the test case, Joshua... and I need to get the date of the LAST (chronologically) entry for that name. The closest I've come uses DMAX...

A                    B
1  | Who           |   Last Review
2  |  Joshua       |   =DMAX('review_log'.$A$2:$B$1003,"Date",{"Who";"Joshua"}

Now right now, this DMAX works! However, the name "Joshua" is hard coded into it. I need this function to work dynamically so that "Joshua" in the criteria array is replaced with the value of A2... I have tried simply putting A2 there, "A2", =A2, "=A2", using the cell function... and I can't get anything to work!

Anyone have any ideas? :) Thank you all so much!

[edit]

Thanks to a brilliant function by pierre-yves samyn, I am so so close to having this document fully functional! The problem is I need to pull another piece of data out along with the date! Here is the actual spreadsheet I'm stuck on for clarity. It's the first sheet ("current"), column F is all that's left, with the solutions for C and E already found!

council record.ods

This forum is amazing! Thank you all, I had nearly given up hope this was possible! --Joshua

[edit]

So in using this sheet we've found a bug, which happens when two entries on the advocacy log page have the same date. As shown in this file, the F9 cell on the 'current' tab should read Joshua, based on the entries in the 'advocacy log' tab. I would really appreciate any solutions you can come up with, I'm at a loss.

council record.ods

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2016-03-16 02:02:03.998822

Comments

Interestingly, I have determined that the cleanest solution, which doesn't work in Calc, DOES work in google sheets! It accepts A3 instead of "Joshua" in the {} syntax, generating the array dynamically and functioning perfectly.

joshuaos gravatar imagejoshuaos ( 2015-07-30 19:12:31 +0200 )edit

= IF ( $A5 <> "", MATCH ( IF ( AND ( 'advocacy log'.$B$3:$B$1003 = $A5, 'advocacy log'.$A$3:$A$1003 = $E5 ), $A$1003:$B$1003 ), 'advocacy log'.$C$3:$C$1003 ) , "" )

get's #N/A... good approach?

joshuaos gravatar imagejoshuaos ( 2015-07-31 06:17:12 +0200 )edit

3 Answers

Sort by » oldest newest most voted
0

answered 2015-07-29 16:16:01 +0200

pierre-yves samyn gravatar image

updated 2015-07-31 14:55:42 +0200

Hi

Pivot Table is the simplest solution, so the best IMO. Just for fun a (very) complicated formula solution.

I tried to explain in the spreadsheet itself.

FindMax.ods

[EDIT]

New version with formula for col F (I hope I have understood your request?) council recordPys.ods

Regards

edit flag offensive delete link more

Comments

That is very interesting, and I think it solves my problem... I am still working on understanding this solution...

joshuaos gravatar imagejoshuaos ( 2015-07-31 00:22:06 +0200 )edit

Okay, that is absolutely brilliant. It works perfectly. I don't completely understand it, but I've managed to implement it. Not only did you solve the question I asked, but you solved a problem I hadn't even thought to try and solve, that of creating the "current" list of who is actually here, which I thought fine to maintain manually. Fantastically done, man! I'm working on adapting it to the rest of the sheet now! Thank you!

joshuaos gravatar imagejoshuaos ( 2015-07-31 01:07:36 +0200 )edit

What if I need to pull another piece of data out of the log? I need to pull another column out of the log, on that same row as the last date, while still matching the name. Even now having the date in question and the name I can't figure out how to have two criteria in the search. DMAX could do it, but only if we could dynamically generate the array, so I'm back to the same problem! If we could return the row in question, I could use offset. Any insight?

joshuaos gravatar imagejoshuaos ( 2015-07-31 01:49:50 +0200 )edit

You are absolutely fantastic. It works! I've been beating my head against this wall for ages, and you've completely solved it. I can't thank you enough!

joshuaos gravatar imagejoshuaos ( 2015-07-31 15:57:32 +0200 )edit

So we've been really using that sheet, and have found a bug in the F column, which happens when two entries on the advocacy log tab have the same date (which happens frequently), as shown in the file I am editing the question to add. I can barely understand that brilliant formula you built and hoped you could chime in with a fix for this bug, please. :)

joshuaos gravatar imagejoshuaos ( 2015-10-24 01:16:58 +0200 )edit
0

answered 2015-07-28 19:03:09 +0200

karolus gravatar image

updated 2015-07-28 19:10:35 +0200

set up →Data→Pivottable...

drag&drop Who into Rowfield, drag&drop Date into Datafield, change Aggregatfunction from sum to max and hit ok

or change your Formula to:

=DMAX('review_log'.$A$1:$B$1003,"Date",A1:A2)
edit flag offensive delete link more

Comments

So, I did try that (making the array A1:A2) and it does work... however it works ONLY for the first name. There will be a whole list of names which need to pull data from the log, and so it needs to work for all of them....

The other solution (Pivottable)... Hmm... a little confused, but trying...

joshuaos gravatar imagejoshuaos ( 2015-07-28 20:56:33 +0200 )edit

Sorry, I still don't get it. Do I use the review_log as the data set for the pivot table? How does that interact with the function that pulls the data from the log?

joshuaos gravatar imagejoshuaos ( 2015-07-28 21:00:34 +0200 )edit

however it works ONLY for the first...

thats the reason for using Pivottable start from one cell in Source.

karolus gravatar imagekarolus ( 2015-07-28 21:29:10 +0200 )edit
0

answered 2015-07-28 19:11:06 +0200

Alex Kemp gravatar image

"...names and dates entered forever and the list getting longer."

You are using the wrong kind of app for this kind of data. You need to use a DB (database) App, else one day you will likely run out of memory.

edit flag offensive delete link more

Comments

It's true that a database would be better... however the rate at which this will grow is very slowly... maybe one or two lines per month, so I figure this will work for a damn long time, neh? (that is, if I can figure out this formula!)

joshuaos gravatar imagejoshuaos ( 2015-07-28 20:54:18 +0200 )edit

Question Tools

1 follower

Stats

Asked: 2015-07-28 18:21:10 +0200

Seen: 352 times

Last updated: Oct 24 '15