VBA: Find latest date in row and return header and data

omnivl

Board Regular
Joined
Aug 25, 2014
Messages
53
I have a header and rows of data that looks like so:

[TABLE="width: 500"]
<tbody>[TR]
[TD]Status[/TD]
[TD]Contract Number[/TD]
[TD]Comments[/TD]
[TD]Advertised[/TD]
[TD]Closed[/TD]
[TD]Evaluated[/TD]
[TD]Contract Value[/TD]
[TD]Awarded[/TD]
[/TR]
[TR]
[TD]Executed[/TD]
[TD]1[/TD]
[TD]waiting on david[/TD]
[TD]20/11/17[/TD]
[TD]30/11/17[/TD]
[TD]1/12/17[/TD]
[TD]$50,000[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Open[/TD]
[TD]2[/TD]
[TD]Finalising contract[/TD]
[TD]10/11/17[/TD]
[TD]16/11/17[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Open[/TD]
[TD]3[/TD]
[TD]not sure[/TD]
[TD]5/11/18[/TD]
[TD]10/11/18[/TD]
[TD]13/11/18[/TD]
[TD]$21,000[/TD]
[TD]15/11/18[/TD]
[/TR]
</tbody>[/TABLE]


Firstly i need to look at status, if the status is "Executed" then ignore and go to the next row. It then needs to find the latest date entered for that row, in row 2 this would be 16/11/17, it needs to then put into an array the contract number "2", then comments "Finalising contract" then the date 16/11/17 followed by the latest date header Closed

Once they are in an array i need to print them to sheet1 in the workbook for example


[TABLE="width: 500"]
<tbody>[TR]
[TD]Contract Number: 2, Closed - 16/11/17, Finalising contract[/TD]
[/TR]
[TR]
[TD]Contract Number: 3, Awarded - 15/11/18, not sure[/TD]
[/TR]
</tbody>[/TABLE]

Any help would be really appreciated!

Thanks
Ben
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
Which columns are the columns you want to check the date?
There is a whole range with dates and some non-date values in between.
I adde a column with this formula but since I don't know the whole range:

Code:
=IF($A2="Executed","",MAX(AQ2,AO2,AN2,AM2,AK2,AJ2,AI2,AH2,Q2,R2,S2,T2,U2,V2,W2))
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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