Find last date in column with mixed data

Luke777

Board Regular
Joined
Aug 10, 2020
Messages
246
Office Version
  1. 365
Platform
  1. Windows
Hi,

Column A is part of a larger dataset, it includes non-repeated dates and repeating strings. For example, 01/01/2024, followed by names (info in columns to right), 02/01/2024, followed by the same names with info on the right. Sounds a little messy, but presentation-wise, its about the best way to format the data.

Anyway.. I'm using the following code to find the biggest date (its always in order)

VBA Code:
Max_date = Application.WorksheetFunction.Max(Columns("A"))

Which works fine.. only I want the cell address (preferably just the row number but I can work that bit out myself I think), not the value itself

The only solution I can think of is then pass Max date through .Find? I'm not sure if that's the best way though

Any suggestions?

Thanks
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
only I want the cell address (preferably just the row number but I can work that bit out myself I think), not the value itself
Check this and revert - This worked for me, but I didn't have mix data.

Excel Formula:
=ADDRESS(MATCH(MAX(A:A),A:A,0),COLUMN(A:A),4,1)
 
Upvote 0
Hi,

Column A is part of a larger dataset, it includes non-repeated dates and repeating strings. For example, 01/01/2024, followed by names (info in columns to right), 02/01/2024, followed by the same names with info on the right. Sounds a little messy, but presentation-wise, its about the best way to format the data.

Anyway.. I'm using the following code to find the biggest date (its always in order)

VBA Code:
Max_date = Application.WorksheetFunction.Max(Columns("A"))

Which works fine.. only I want the cell address (preferably just the row number but I can work that bit out myself I think), not the value itself

The only solution I can think of is then pass Max date through .Find? I'm not sure if that's the best way though

Any suggestions?

Thanks

Solved with the following
VBA Code:
lDate = Sheet1.Range("A1:A" & lRow).Find(What:=Max_date, LookIn:=xlValues).Address

Would appreciate any feedback on this solution
 
Upvote 0
Solution

Forum statistics

Threads
1,223,911
Messages
6,175,333
Members
452,636
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top