Find Most recent date in a row and return that date along with Column Heading

jski21

Board Regular
Joined
Jan 2, 2019
Messages
133
Office Version
  1. 2016
Platform
  1. Windows
Good day Mr. Excel Team,

Is there a known way to find the most recent date in a row and return that date along with the Column Heading it is in? Thanks!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
=INDEX(B1:L1,MATCH(MAX(B2:L2),B2:L2,0))

Index( B1:L1 = return a value from this range
Find the Highest Value in ,MATCH(MAX(B2:L2) - so as dates are just numbers incremented by 1 each day from 1900 - then the latest date , will be the highest number
Look that MAX up in this ROW B2:L2
Now 0 - means an EXACT match ONLY

Then a Simple MAX(), will return the actual date

Note XL2BB returns US date format - MM/DD/YY
even though i'm in UK

It would be helpful to have your Excel version in the profile, as later versions have more functions and some things are easier to do with those functions

Book1
ABCDEFGHIJKL
1A1A2A3A4A5A6A7A8A9A10A11
23/1/214/1/215/1/216/1/227/1/218/1/219/1/2110/1/2111/1/2112/1/211/1/22
3
4A4
56/1/22
6
Sheet1
Cell Formulas
RangeFormula
A4A4=INDEX(B1:L1,MATCH(MAX(B2:L2),B2:L2,0))
A5A5=MAX(B2:L2)
 
Upvote 0
Good day Mr. Excel Team,

Is there a known way to find the most recent date in a row and return that date along with the Column Heading it is in? Thanks!
Also, try this,

=OFFSET($A$2, -1, MATCH(MIN(2:2), 2:2, 0)-1)

MIN can be used across a range of dates and return the most recent, or MAX for oldest.
OFFSET is just being used to return the header above the MIN match.
 
Upvote 0
=INDEX(B1:L1,MATCH(MAX(B2:L2),B2:L2,0))

Index( B1:L1 = return a value from this range
Find the Highest Value in ,MATCH(MAX(B2:L2) - so as dates are just numbers incremented by 1 each day from 1900 - then the latest date , will be the highest number
Look that MAX up in this ROW B2:L2
Now 0 - means an EXACT match ONLY

Then a Simple MAX(), will return the actual date

Note XL2BB returns US date format - MM/DD/YY
even though i'm in UK

It would be helpful to have your Excel version in the profile, as later versions have more functions and some things are easier to do with those functions

Book1
ABCDEFGHIJKL
1A1A2A3A4A5A6A7A8A9A10A11
23/1/214/1/215/1/216/1/227/1/218/1/219/1/2110/1/2111/1/2112/1/211/1/22
3
4A4
56/1/22
6
Sheet1
Cell Formulas
RangeFormula
A4A4=INDEX(B1:L1,MATCH(MAX(B2:L2),B2:L2,0))
A5A5=MAX(B2:L2)
etaf,

Very instructive and thank you. I receive an #N/A for the column output and 1/0/1900 for the date output when I use it in my sheet:

CARES Act Grant Balances by Major Program.xlsx
BBBCBDBEBFBGBHBIBJBKBLBMBNBO
1AllPIFsInDTDraftApprovedDTScopeOutforSigDTScopeSignedDTScopeSignedDirDTToAcctRound1DTToOBMDTFromLawDTToAcctRound2DTFinishDTDurationDaysInCert
26/8/20166/24/20168/4/20163 /24/2017256#Error#N/A1/0/1900
All
Cell Formulas
RangeFormula
BN2BN2=INDEX(BB1:BK1,MATCH(MAX(BB2:BK2),BB2:BK2,0))
BO2BO2=MAX(BB2:BK2)
 
Upvote 0
etaf,

Very instructive and thank you. I receive an #N/A for the column output and 1/0/1900 for the date output when I use it in my sheet:

CARES Act Grant Balances by Major Program.xlsx
BBBCBDBEBFBGBHBIBJBKBLBMBNBO
1AllPIFsInDTDraftApprovedDTScopeOutforSigDTScopeSignedDTScopeSignedDirDTToAcctRound1DTToOBMDTFromLawDTToAcctRound2DTFinishDTDurationDaysInCert
26/8/20166/24/20168/4/20163 /24/2017256#Error#N/A1/0/1900
All
Cell Formulas
RangeFormula
BN2BN2=INDEX(BB1:BK1,MATCH(MAX(BB2:BK2),BB2:BK2,0))
BO2BO2=MAX(BB2:BK2)
Actually found a bit of the solution...seems the date fields have some spaces in them (not my spreadsheet mind you. Trying to take over/improve from previous owner). But how could it best handle the blank items?
 
Upvote 0
i copied into a sheet and used the formula , only changed the range

I'm on version 365 - try using an array entry , as you are on 2016 version, which does not deal with arrays automatically
Press Ctrl+Shift+Enter

BUT =MAX(BB2:BK2) should work, blanks dont matter, as its a MAX , MIN would

you could put the spreadsheet on a share like onedrive , dropbox i tend to use
Make sure NO private data is available as it is a public forum and will be seen by anyone on the internet

Book1
ABCDEFGHIJKLMN
1AllPIFsInDTDraftApprovedDTScopeOutforSigDTScopeSignedDTScopeSignedDirDTToAcctRound1DTToOBMDTFromLawDTToAcctRound2DTFinishDTDurationDaysInCert
28/6/166/24/164/8/163/24/17256#ErrorFinishDT3/24/17
Sheet3
Cell Formulas
RangeFormula
M2M2=INDEX(A1:J1,MATCH(MAX(A2:J2),A2:J2,0))
N2N2=MAX(A2:J2)
 
Upvote 0
i copied into a sheet and used the formula , only changed the range

I'm on version 365 - try using an array entry , as you are on 2016 version, which does not deal with arrays automatically
Press Ctrl+Shift+Enter

BUT =MAX(BB2:BK2) should work, blanks dont matter, as its a MAX , MIN would

you could put the spreadsheet on a share like onedrive , dropbox i tend to use
Make sure NO private data is available as it is a public forum and will be seen by anyone on the internet

Book1
ABCDEFGHIJKLMN
1AllPIFsInDTDraftApprovedDTScopeOutforSigDTScopeSignedDTScopeSignedDirDTToAcctRound1DTToOBMDTFromLawDTToAcctRound2DTFinishDTDurationDaysInCert
28/6/166/24/164/8/163/24/17256#ErrorFinishDT3/24/17
Sheet3
Cell Formulas
RangeFormula
M2M2=INDEX(A1:J1,MATCH(MAX(A2:J2),A2:J2,0))
N2N2=MAX(A2:J2)
 
Upvote 0
Thanks etaf. Yeah, 1/0/1900 only occurs if there is no data in any of the columns. I can deal with this for now as it identifies the outliers and need for investigation.

Thanks again for the instruction!

jski
 
Upvote 0
you could use an IF to leave the cell blank , if no dates entered in the range
=IF(MAX(BB2:BK2)=0, "", MAX(BB2:BK2))

Will also need to do that on the
=INDEX(BB1:BK1,MATCH(MAX(BB2:BK2),BB2:BK2,0))


As it should see 0 as max and return the first 0 found

=IF (INDEX(BB1:BK1,MATCH(MAX(BB2:BK2),BB2:BK2,0))= 0 , "" , INDEX(BB1:BK1,MATCH(MAX(BB2:BK2),BB2:BK2,0)) )
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

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