Finding Date Closest to Today but Not in the Future

gambit023

New Member
Joined
Jul 14, 2009
Messages
29
Hello all, I'm trying to use conditional formatting to highlight the row of data with a date that is closest to today but not in the future.

I am currently using =$A2=TODAY() in conditional formatting, but this will not highlight the date if today's date is not on the list. I would like to highlight the last in the series of dates that's closest to today but not in the future.

Can someone help?


view

DateCheck #PayeeComments Expense DepositBalance
1/12/2018Deposit $ 3,500.00$7,144.18
1/12/2018Cell Phone $ 70.00$7,074.18
1/16/2018Car Payment $ 281.58$6,792.60
1/21/2018Credit Card $ 229.00$6,563.60
1/21/2018Insurance $ 44.01$6,519.59
1/21/2018Withdraw $ 60.00$1,548.57
1/29/2018Gas and Electric $ 222.25$4,826.32

<tbody>
</tbody>
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
I don't think this is possible using conditional formatting alone (Though I hope someone proves me wrong). You will have to use either an array formula or vba (I would use an array formula).

Place this formula in an adjacent cell next to the date, and press cntrl+shift+enter to make the equation an array formula:
=IF(A2=MAX(IF(A:A<TODAY(),A:A,0)),1,0)
Array formula should look like this if done correctly {=IF(A2=MAX(IF(A:A<TODAY(),A:A,0)),1,0)}

Drag/Copy down the formula. This should show a 1 for dates that meet your criteria and a 0 for dates that do not (In your example, a 1 would show for the three records with the date 1/21). From there you can use conditional formatting to highlight the rows where the formula produces the number 1.

Hope this helps.
 
Upvote 0
Hi,

Actually, it is possible:


Book1
ABCDEFGHI
1DateCheck #PayeeCommentsExpenseDepositBalance
21/12/2018Deposit$3,500.00$7,144.18FALSE
31/12/2018Cell Phone$70.00$7,074.18FALSE
41/16/2018Car Payment$281.58$6,792.60FALSE
51/21/2018Credit Card$229.00$6,563.60TRUE
61/21/2018Insurance$44.01$6,519.59TRUE
71/21/2018Withdraw$60.00$1,548.57TRUE
81/29/2018Gas and Electric$222.25$4,826.32FALSE
Sheet7
Cell Formulas
RangeFormula
I2=A2=LARGE(A$2:A$8,COUNTIF(A$2:A$8,">"&TODAY())+1)


Use my sample I2 formula for your CF formula rule.
 
Upvote 0

Excel 2010
ABCDEFG
1DateCheck #PayeeCommentsExpenseDepositBalance
21/12/2018Deposit$3,500.00$7,144.18
31/12/2018Cell Phone$70.00$7,074.18
41/16/2018Car Payment$281.58$6,792.60
51/21/2018Credit Card$229.00$6,563.60
61/21/2018Insurance$44.01$6,519.59
71/21/2018Withdraw$60.00$1,548.57
81/29/2018Gas and Electric$222.25$4,826.32
Sheet27


=$A2:$G8=LOOKUP(TODAY(),$A2:$A8)
 
Last edited:
Upvote 0

Forum statistics

Threads
1,215,205
Messages
6,123,634
Members
449,109
Latest member
Sebas8956

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