How to find the latest time per name in a table with names and times
Solved/Closed
anitatelecon
Posts
7
Registration date
Monday July 15, 2019
Status
Member
Last seen
August 26, 2019
-
Updated on Aug 27, 2019 at 11:56 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 27, 2019 at 11:44 AM
TrowaD Posts 2921 Registration date Sunday September 12, 2010 Status Moderator Last seen December 27, 2022 - Aug 27, 2019 at 11:44 AM
Related:
- Looks like you’ve tried to sign in unsuccessfully too many times. recover your id or reset your password to continue.
- Samsung duos reset password - Guide
- How to recover facebook password without email and phone number - Guide
- Battery reset code - Guide
- @ Sign on keyboard - Guide
- How to reset windows 10 password without logging in - Guide
2 responses
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Jul 16, 2019 at 12:00 PM
Jul 16, 2019 at 12:00 PM
Hi Anitatelecon,
I noticed 2 things in your data.
- The dates are in the column to the right of the names.
- The dates are ordered A->Z.
Under those conditions I created a custom function for you.
First implement the code below in a standard module (Alt+f11 to open VBA window, click Insert on top menu, click on Module and paste the code in the big white field):
Now you got acces to the function HigestValue(NameToSearch,ListOfNames).
As an example of how to use this function: Place the unique names of column B in column E (Copy column B to E, select column E, go to Data ribbon and click on Remove Duplicates).
Now in F2 type: =HigestValue(E2,B:B)
Drag the formula down as far as you have unique values in column E.
Let us know how this works out.
Best regards,
Trowa
I noticed 2 things in your data.
- The dates are in the column to the right of the names.
- The dates are ordered A->Z.
Under those conditions I created a custom function for you.
First implement the code below in a standard module (Alt+f11 to open VBA window, click Insert on top menu, click on Module and paste the code in the big white field):
Function HighestValue(NameToSearch As String, ListOfNames As Range) Dim lRow, x As Long lRow = Cells(Rows.Count, MyRange.Column).End(xlUp).Row For x = lRow To 1 Step -1 If Cells(x, MyRange.Column) = sValue Then HighestValue = Cells(x, MyRange.Column + 1).Value Exit Function End If Next x End Function
Now you got acces to the function HigestValue(NameToSearch,ListOfNames).
As an example of how to use this function: Place the unique names of column B in column E (Copy column B to E, select column E, go to Data ribbon and click on Remove Duplicates).
Now in F2 type: =HigestValue(E2,B:B)
Drag the formula down as far as you have unique values in column E.
Let us know how this works out.
Best regards,
Trowa
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Aug 26, 2019 at 11:37 AM
Aug 26, 2019 at 11:37 AM
Hi Anitatelecon,
Apparently I didn't change the declared names going from sub to function.
Could you replace the code with the one below and see how that goes:
Best regards,
Trowa
Apparently I didn't change the declared names going from sub to function.
Could you replace the code with the one below and see how that goes:
Function HighestValue(NameToSearch As String, ListOfNames As Range) Dim lRow, x As Long lRow = Cells(Rows.Count, ListOfNames.Column).End(xlUp).Row For x = lRow To 1 Step -1 If Cells(x, ListOfNames.Column) = NameToSearch Then HighestValue = Cells(x, ListOfNames.Column + 1).Value Exit Function End If Next x End Function
Best regards,
Trowa
anitatelecon
Posts
7
Registration date
Monday July 15, 2019
Status
Member
Last seen
August 26, 2019
Aug 26, 2019 at 04:07 PM
Aug 26, 2019 at 04:07 PM
Thanks Trowa. It worked. I only had to modify the results format to convert into date and I got the result I was looking for. Really appreciated your help !!!!!
TrowaD
Posts
2921
Registration date
Sunday September 12, 2010
Status
Moderator
Last seen
December 27, 2022
555
Aug 27, 2019 at 11:44 AM
Aug 27, 2019 at 11:44 AM
Thanks for the feedback Anitatelecon! Though I feel bad it took so long, I'm glad it all worked out.
Updated on Jul 16, 2019 at 02:19 PM
Jul 25, 2019 at 11:31 AM
Aug 6, 2019 at 11:51 AM
Sorry for the very late response, didn't mean to leave you hanging.
It looks to me as you would have to use a semi-colon instead of a comma. That would depend on the Excel regional version you have. I have to use the semi-colon, but most people here have to use the comma.
So try:
=HigestValue(E2;B:B)
Best regards,
Trowa
Aug 20, 2019 at 03:32 PM
Didn't work neither. Got an error.
Updated on Aug 20, 2019 at 03:44 PM