Conditional Formatting, Dates and Times

emfish

New Member
Joined
May 13, 2022
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hey guys,

** Context **
I work in television advertising, where we have to make sure that none of our spots (ie. the times when our ads are showing) are playing on the same station (channel) within a 16 minute interval.

Each week, we copy all of the spots (often tens of thousands) that we have into an excel document.

The data look something like the following (but imagine 10000000000 more rows):

1652442610504.png


** Brief **

I am trying to find a quick and easy way to not only identify, but also single out the, what we call, "consecutive breaks" - i.e. spots that play on the same station within a 16 minute interval.

At the moment, I have done the following:

  • As the time is pasted in as a number, I am unable to simply reformat it into a time, so I have added a column to the left with the following formula : =TIMEVALUE(LEFT(F2,LEN(F2)-2)&":"&RIGHT(F2,2))
    This has given the data in column F a time function.
  • I then applied Conditional Formatting to the cells with column A the following custom formula: =ABS(A2-A1)<16/(24*60)
    As you can see, this has made the spots appearing within a 16 minute interval appear in Red.
    HOWEVER, this doesn't take into account the date, which is why the data in cell a5 has also appeared in red.
    Additionally, this only highlights ONE of the rows involved in the consecutive break (e.g. A2, but not A3), which means I cannot simply filter by "Consecutive breaks", as one of them would not appear.
  • If the date was able to be taken into consideration in the conditional formatting, I could leave it as is, and scroll through all of the ones that appear in Red, and pair them up, however, when there are huge amounts of data, this takes FOREVER, and I'm sure there is a more efficient way of doing this.
My goal is to make all of the spots that appear on the same date, within a 16 minute interval appear in red, so that I can then set a "filter by colour" filter, and see them all there.

Thank you in advance for your help,

Emma
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
i'm assuming you are sorting in date and time order
=ABS(A2-A1)<16/(24*60)
Add an AND to also include the date

=AND( ABS(A2-A1)<16/(24*60) , E2=E1 )
however ,
if the ad goes over midnight and say runs at 23:55 and again at 00:05
is that to be included and counted ?

Note: Images are difficult to see , and also requires that I input all the data myself, which is very time consuming.

A SMALL sample spreadsheet, around 10-20 rows, would help a lot here, with all sensitive data removed, and expected results mocked up and manually entered, with a few notes of explanation.

MrExcel has a tool called “XL2BB” that lets you post samples of your data and will allow us to copy/paste your sample data into our Excel spreadsheets, saving a lot of time.

You can also test to see if it works ok, in the "Test Here" forum.

OR if you cannot get XL2BB to work, or have restrictions on your PC , then put the sample spreadsheet onto a share
I only tend to goto OneDrive, Dropbox or google docs , as I'm never certain of other random share sites and possible virus.
 
Upvote 0
you need to grant access for anyone to open
 
Upvote 0
formula works ok for me , need to change the range to meet your data , B and G
also added B2<>"" , so blanks are not included

how is this , but as i say
if the ad goes over midnight and say runs at 23:55 and again at 00:05
is that to be included and counted ?
XL2BB below and on dropbox - dropbox will only be on for a few days, then i delete the file


as you have the time elapsed in column C , you could use that maybe something like =AND(C2<>"",C2<=TIMEVALUE("0:15:0")) - BUT you have -ve time


Clash Report.xlsx
ABCDEFGHIJKLM
1StationClient Short NameDayDateTimeSecProduct Short NameProgramme Before
211:40:00CARLTONBrand 1MON5/16/22114020Product 1THIS MORNINGFALSE
311:55:000:15:00CARLTONBrand 1MON5/16/22115530Product 2LOOSE WOMENTRUE
413:28:001:33:00CARLTONBrand 1MON5/16/22132830Product 3LOOSE WOMENFALSE
516:15:002:47:00CARLTONBrand 1MON5/16/22161510Product 4TIPPING POINTFALSE
616:30:000:15:00CARLTONBrand 2MON5/16/22163010Product 1TIPPING POINTTRUE
716:58:000:28:00CARLTONBrand 1MON5/16/22165830Product 2TIPPING POINTFALSE
819:58:003:00:00CARLTONBrand 1MON5/16/22195820Product 3EMMERDALEFALSE
910:15:00###############################################CARLTONBrand 1TUE5/17/22101510Product 4THIS MORNINGFALSE
1002:25:00###############################################CARLTONBrand 2TUE5/17/22262510Product 1THIS MORNINGFALSE
1114:15:0011:50:00CARLTONBrand 1TUE5/17/22141530Product 2DICKINSONS REAL DEAL REPEATFALSE
1214:30:000:15:00CARLTONBrand 1TUE5/17/22143020Product 3TENABLE RPTTRUE
1316:15:001:45:00CARLTONBrand 1TUE5/17/22161510Product 4TIPPING POINTFALSE
1417:30:001:15:00CARLTONBrand 1TUE5/17/22173010Product 1LINGO RPTFALSE
1520:15:002:45:00CARLTONBrand 2TUE5/17/22201510Product 2MARTIN CLUNES ISLANDS OF OZ RPFALSE
1610:50:00###############################################CARLTONBrand 1WED5/18/22105030Product 3THIS MORNINGFALSE
1711:25:000:35:00CARLTONBrand 1WED5/18/22112530Product 4THIS MORNINGFALSE
18FALSE
19FALSE
20FALSE
21FALSE
22FALSE
Sheet1
Cell Formulas
RangeFormula
B2:B17B2=TIMEVALUE(LEFT(H2,LEN(H2)-2)&":"&RIGHT(H2,2))
C3:C17C3=B3-B2
M2:M22M2=AND( ABS(B1-B2)<16/(24*60), G2=G1,B2<>"")
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:C34Expression=AND( ABS(B1-B2)<16/(24*60), G2=G1,B2<>"")textNO
 
Upvote 0
so for example using column C - see formula in column N
also fixed the -ve times

Clash Report.xlsx
ABCDEFGHIJKLMN
1StationClient Short NameDayDateTimeSecProduct Short NameProgramme BeforeDate&TimeJust C
211:40:00CARLTONBrand 1MON5/16/22114020Product 1THIS MORNINGFALSEFALSE
311:55:000:15:00CARLTONBrand 1MON5/16/22115530Product 2LOOSE WOMENTRUETRUE
413:28:001:33:00CARLTONBrand 1MON5/16/22132830Product 3LOOSE WOMENFALSEFALSE
516:15:002:47:00CARLTONBrand 1MON5/16/22161510Product 4TIPPING POINTFALSEFALSE
616:30:000:15:00CARLTONBrand 2MON5/16/22163010Product 1TIPPING POINTTRUETRUE
716:58:000:28:00CARLTONBrand 1MON5/16/22165830Product 2TIPPING POINTFALSEFALSE
819:58:003:00:00CARLTONBrand 1MON5/16/22195820Product 3EMMERDALEFALSEFALSE
910:15:00 CARLTONBrand 1TUE5/17/22101510Product 4THIS MORNINGFALSEFALSE
1002:25:00 CARLTONBrand 2TUE5/17/22262510Product 1THIS MORNINGFALSEFALSE
1114:15:0011:50:00CARLTONBrand 1TUE5/17/22141530Product 2DICKINSONS REAL DEAL REPEATFALSEFALSE
1214:30:000:15:00CARLTONBrand 1TUE5/17/22143020Product 3TENABLE RPTTRUETRUE
1316:15:001:45:00CARLTONBrand 1TUE5/17/22161510Product 4TIPPING POINTFALSEFALSE
1417:30:001:15:00CARLTONBrand 1TUE5/17/22173010Product 1LINGO RPTFALSEFALSE
1520:15:002:45:00CARLTONBrand 2TUE5/17/22201510Product 2MARTIN CLUNES ISLANDS OF OZ RPFALSEFALSE
1610:50:00 CARLTONBrand 1WED5/18/22105030Product 3THIS MORNINGFALSEFALSE
1711:25:000:35:00CARLTONBrand 1WED5/18/22112530Product 4THIS MORNINGFALSEFALSE
18FALSEFALSE
19FALSEFALSE
20FALSEFALSE
21FALSEFALSE
22FALSEFALSE
23FALSEFALSE
Sheet1
Cell Formulas
RangeFormula
B2:B17B2=TIMEVALUE(LEFT(H2,LEN(H2)-2)&":"&RIGHT(H2,2))
M2:M23M2=AND( ABS(B1-B2)<16/(24*60), G2=G1,B2<>"")
N2:N23N2=AND(C2<>"",C2<=TIMEVALUE("0:15:0"))
C3:C17C3=IF(B3-B2<0,"",B3-B2)
Cells with Conditional Formatting
CellConditionCell FormatStop If True
C2:C34Expression=AND( ABS(B1-B2)<16/(24*60), G2=G1,B2<>"")textNO
 
Upvote 0

Forum statistics

Threads
1,214,656
Messages
6,120,762
Members
448,991
Latest member
Hanakoro

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