Condtional Formatting - Date and Time within 15 minutes of each other

Status
Not open for further replies.

eli_m

Board Regular
Joined
Jun 2, 2022
Messages
155
Office Version
  1. 365
Platform
  1. Windows
Hi all,

I currently have this helper column:
1684995793138.png


It combines two columns together using this formula:
Excel Formula:
=IF([@[Planning Date]]="N/A","",
IF(ISFORMULA([@[Planning Time]]),"",
CONCATENATE(TEXT([@[Planning Date]],"dd/mm/yy")," ",TEXT([@[Planning Time]],"hh:mm am/pm"))))

I want to make it so that the cells show up RED if any of the rows are less than 30 minutes (29 minutes to be exact) from each other.

What would be the best way and formula for this in conditional formatting?

Thanks in advance!
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
Hi there...

You can try this formula in the Use formula to determine formatting part of CF...

Excel Formula:
=AND(ROW()>1, ABS($B2-$B1)*1440<29)
 
Upvote 0
Hi there...

You can try this formula in the Use formula to determine formatting part of CF...

Excel Formula:
=AND(ROW()>1, ABS($B2-$B1)*1440<29)
Hi there!

First off thanks for your help. Thats got me a little confused.

My column is "AY" and my data starts on row: AY3

When I change the CF to:
=AND(ROW()>1, ABS($AY2-$AY1)*1440<29)

It doesn't change the cell colour.

What am I doing wrong here? (probably a lot! haha)
 
Upvote 0
Mmmmm In what columns are your planning date and planning time... these are the two that should be subtracted... maybe my test example will help...

Book1.xlsx
ABC
1Planning DatePlanning TimeColumn3
222/03/202313:4522/03/2023 01:45 pm
322/03/202314:0022/03/2023 02:00 pm
422/03/202314:4522/03/2023 02:45 pm
522/03/202315:0022/03/2023 03:00 pm
622/03/202315:2822/03/2023 03:28 pm
722/03/202316:0022/03/2023 04:00 pm
822/03/202316:0522/03/2023 04:05 pm
922/03/202316:2522/03/2023 04:25 pm
1022/03/202317:2522/03/2023 05:25 pm
1122/03/202318:2522/03/2023 06:25 pm
1222/03/202318:3022/03/2023 06:30 pm
Sheet1
Cell Formulas
RangeFormula
C2:C12C2=IF([@[Planning Date]]="N/A","", IF(ISFORMULA([@[Planning Time]]),"", CONCATENATE(TEXT([@[Planning Date]],"dd/mm/yy")," ",TEXT([@[Planning Time]],"hh:mm am/pm"))))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:C12Expression=AND(ROW()>1, ABS($B2-$B1)*1440<29)textNO
 
Upvote 0
Mmmmm In what columns are your planning date and planning time... these are the two that should be subtracted... maybe my test example will help...

Book1.xlsx
ABC
1Planning DatePlanning TimeColumn3
222/03/202313:4522/03/2023 01:45 pm
322/03/202314:0022/03/2023 02:00 pm
422/03/202314:4522/03/2023 02:45 pm
522/03/202315:0022/03/2023 03:00 pm
622/03/202315:2822/03/2023 03:28 pm
722/03/202316:0022/03/2023 04:00 pm
822/03/202316:0522/03/2023 04:05 pm
922/03/202316:2522/03/2023 04:25 pm
1022/03/202317:2522/03/2023 05:25 pm
1122/03/202318:2522/03/2023 06:25 pm
1222/03/202318:3022/03/2023 06:30 pm
Sheet1
Cell Formulas
RangeFormula
C2:C12C2=IF([@[Planning Date]]="N/A","", IF(ISFORMULA([@[Planning Time]]),"", CONCATENATE(TEXT([@[Planning Date]],"dd/mm/yy")," ",TEXT([@[Planning Time]],"hh:mm am/pm"))))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:C12Expression=AND(ROW()>1, ABS($B2-$B1)*1440<29)textNO

That looks great and so clear so I don't know how I messed it up:
My date and time is in column U and V and starts on ROW 3 downwards
1684998741475.png


Column AY holds the CONCENATE:
1684998795131.png


CF is:
1684998819667.png


Excel Formula:
=AND(ROW()>1, ABS($V3-$V2)*1440<29)

is it the CF formula I have wrong?
 
Upvote 0
just an idea

are the dates and times - real or just TEXT
right click - format and set to general - you should see a number - integer for dates and decijust mal for time
 
Upvote 0
just an idea

are the dates and times - real or just TEXT
right click - format and set to general - you should see a number - integer for dates and decijust mal for time
Column U:

1684999530899.png



Column V:
1684999571658.png


I'd say they are real and not just text
 
Upvote 0
as i said, change to General and see if you get a decimal
Book25
EF
9textGeneral
1012:340.52361111
Sheet2
 

Attachments

  • Screenshot 2023-05-25 at 08.49.44.jpeg
    Screenshot 2023-05-25 at 08.49.44.jpeg
    47.4 KB · Views: 4
Upvote 0
Status
Not open for further replies.

Forum statistics

Threads
1,223,911
Messages
6,175,337
Members
452,637
Latest member
Ezio2866

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