Between dates validation

jl2509

Board Regular
Joined
Oct 30, 2015
Messages
198
Office Version
  1. 365
Platform
  1. Windows
Hi All
Is it possible to have a date validated in a range of dates when it is entered.
i.e. a date is entered "Cell A10" in this case and is validated between dates entered in the range A1:B9 but is continually growing in size

The conflicting dates already entered are highlighted YELLOW and the most recent date is highlighted RED

1710944239567.png
 
I've logged off for the night. The a10 and b10 is relative so should work in conditional formatting except in row 1
 
Upvote 0

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
As soon as a user enters a new date in column A (the next available empty cell in column A) the conditional formatting formula should check to see if the last date entered is greater than all dates in column B, otherwise highlight the last date entered.
That's different to what was previously understood which referenced being between.
For that would this work for you ?

20240321 Date Between Previous dates jl2509.xlsx
AB
1FromTo
230/08/202429/09/2024
35/09/20245/10/2024
47/09/20247/10/2024
518/09/202418/10/2024
620/09/202420/10/2024
725/09/202425/10/2024
89/11/20249/12/2024
918/11/202418/12/2024
1013/12/202412/01/2025
1122/09/202428/10/2024
1213/01/202515/01/2025
1314/01/2025
14
Data
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:A20Expression=AND(A2<>"",A2<=MAX($B$1:$B1))textNO
 
Upvote 0
I tried to make it the same outcome but just using the last date rather than between as I mentioned earlier in the thread.
I have also found some flaws in my methodology, apologies for causing any wasted time.

The new formula looks better but I still get the wrong data highlighted.
I have used a set of data now which shows past dates and current/future dates.
The new date in cell A21 shows row 20 as a conflict, but it should be row 19 that is highlighted?

Book1.xlsx
ABCDEFGHIJK
113/04/202316/04/2023
217/04/202320/04/2023
321/04/202324/04/2023
425/04/202328/04/2023
529/04/202302/05/2023
603/05/202306/05/2023
707/05/202310/05/2023
811/05/202314/05/2023
915/05/202318/05/2023
1019/05/202322/05/2023
1123/05/202326/05/2023
1227/05/202301/02/2024
1301/03/202404/03/2024
1405/03/202408/03/2024
1509/03/202412/03/2024
1613/03/202416/03/2024
1717/03/202420/03/2024
1821/03/202424/03/2024
1925/03/202428/03/2024<-- Should highlight this row as well as the date in A21 conflicts with this row not row 20
2029/03/202401/04/2024
2126/03/2024
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A:BExpression=AND($A2<>"",A2<=MAX($B$1:$B1))textNO
 
Upvote 0
I think I need to start again in explaining this to stop wasting your time.
Now I look back at the intention of this sheet, I do need to use the between function, otherwise I get the wrong data highlighted. in my example below.
As the date entered in A20 is > all other cells in Col B, nothing should be highlighted.

Book1.xlsx
AB
1613/03/202416/03/2024
1717/03/202420/03/2024
1821/03/202424/03/2024
1925/03/202428/03/2024
2029/03/202401/04/2024
2102/04/2024
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A1:B1000Expression=AND($A2<>"",A2<=MAX($B$1:$B1))textNO


If the last date entered is between the date in Column A and Col B, then it should highlight them as per the example below. I hope this is much clearer

Book1.xlsx
AB
1509/03/202412/03/2024
1613/03/202416/03/2024
1717/03/202420/03/2024
1821/03/202424/03/2024
1925/03/202428/03/2024
2029/03/202401/04/2024
2126/03/2024
22
Sheet1
 
Upvote 0
I Should also add that this is only applicable to current and future dates, so this example would not look at any dates above row 19, where the date in cell A21 is not between any other dates
 
Upvote 0
Applying to a larger range than you need A2:B500, try this:
=COUNT(FILTER($A3:$A$500,($A3:$A$500>=$A2)*($A3:$A$500<=$B2),""))<>0
 
Upvote 0
Solution
Thanks again for the support but I am still not getting the desired result!

Using the same data above and the formula you kindly provided I get the wrong cell highlighted as shown below?

Book1.xlsx
ABC
113/04/202316/04/2023
217/04/202320/04/2023
321/04/202324/04/2023
425/04/202328/04/2023
529/04/202302/05/2023
603/05/202306/05/2023
707/05/202310/05/2023
811/05/202314/05/2023
915/05/202318/05/2023
1019/05/202322/05/2023
1123/05/202326/05/2023
1227/05/202301/02/2024
1301/03/202404/03/2024
1405/03/202408/03/2024
1509/03/202412/03/2024
1613/03/202416/03/2024
1717/03/202420/03/2024
1821/03/202424/03/2024<-- Clash shown here is wrong
1925/03/202428/03/2024<-- Should be here (new date in Cell A21 is between dates in A18: B18)
2029/03/202401/04/2024
2126/03/2024<-- New Date Added
22
Sheet1
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:B500Expression=COUNT(FILTER($A4:$A$500,($A4:$A$500>=$A3)*($A4:$A$500<=$B3),""))<>0textNO
 
Upvote 0
Does your data really not have a heading row ? That is a really strange set up.
Your conditional formatting formula is inconsistent with the range.
If your "applied to" range starts at A2 then where you have A3 and B3 it should say A2 and B2.
The range to compare to should start one row down from that so $A3:$A$500 in both spots.
 
Last edited:
Upvote 0
Ok sorted now, not sure how I had changed the formula but adding it back as you proposed works fine. Thanks for the support.
 
Upvote 0

Forum statistics

Threads
1,215,129
Messages
6,123,210
Members
449,090
Latest member
bes000

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