Complex Conditional Formatting IF Statement with Time Calculation (Digital Sign In/Out Spreadsheet)

PNeil

New Member
Joined
Sep 25, 2019
Messages
4
I have been down the rabbit hole for the past few hours on this one... Here is my predicament. I have a spreadsheet the Signs In/Out individuals via barcode scanner (Macro underneath to population times in columns to the right of name). The users of this spreadsheet would like for the name of individuals who have been "Out" for >1hour to highlight. Since individuals leave and return many times during the day, it would only apply to values in the "Out" columns with a blank "In" column to the right. I have imbedded the current time to use in the calculations in cell a cell on the spreadsheet. So, my latest attempt looked like this:
="IF((E27=0), =SUM((D237-D27)*24>1), =SUM((D237-D27)*24<1)" ***I have tried ISBLANK(E27) as well, and E27=""
Essentially IF(("Cell is Blank"), (True if this calculation), (False if this calculation))

I know that doesn't do it as the =SUM calculations should be further True/False statements I believe.

Below is a snip of the spreadsheet as it is now.

NameOut(1)In(1)Out(2)In(2)
NAME
7:02​
7:28​
8:36​

So, looking to highlight the name IF F2 is blank, AND the Sum of the Current Time minus E2 is>1hr

I feel like I am missing something here, I have tried SUMIF, COUNTIF, IF... so many variations and recombinations to get to this point.

Any help would be great- I have conditional formatting to identify relationships between the Out/In time >1 hour, but unable to figure out how to add the condition of a blank cell AND current time.

Thank you

Paul
 

Excel Facts

Workdays for a market open Mon, Wed, Friday?
Yes! Use "0101011" for the weekend argument in NETWORKDAYS.INTL or WORKDAY.INTL. The 7 digits start on Monday. 1 means it is a weekend.
Try this:
It does require that the date also be part of the time stamp (this probably good for wrapping around mid-night.
I don't understand why your rows are 200 rows apart in each calculation though.
Mr Excel 8.xlsm
ABCDEFG
1NameOut(1)In(1)Out(2)In(2)
2NAME07:02:0007:28:0000:15:00TRUE
3
Sheet3
Cell Formulas
RangeFormula
G2G2=AND(ISBLANK(F2),(NOW()-INT(E2)<=E2+(1/24)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:F2Expression=AND(ISBLANK($F2),(NOW()-INT($E2)<=$E2+1))textNO
 
Upvote 0
^^^ I have a calculation error above. will fix in a moment
 
Upvote 0
Here it is again, hopefully this works for you:
Again, if you span midnight this will work for you as well if you put in the date component.
Mr Excel 8.xlsm
ABCDEFG
1NameOut(1)In(1)Out(2)In(2)2023-02-22 02:28
2NAME07:02:0007:28:0001:15:00TRUE
3
Sheet3
Cell Formulas
RangeFormula
G2G2=AND(ISBLANK($F2),($G$1-INT($E2))>=($E2-INT($E2)+(1/24)))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
A2:F2Expression=AND(ISBLANK($F2),($G$1-INT($E2))>=($E2-INT($E2)+(1/24)))textNO
 
Last edited:
Upvote 0
Awoohaw- that's brilliant! Worked like a charm. So, now I have one set of cells that operate as desired- Is there a way to duplicate this formatting across the columns and rows? This sheet is used to track 100+ individuals with 3-20 In/Out's documented.

Below is a snip of what I have going on. Existing formatting in the sheet consists of highlighting cells where the difference in checking out/in is >1hr (for ease of review by staff). Also, in A2 there is the formatting you provided the expression for (targeting the time in the C2/D2 pair) and highlighting the name/vs the span of cells. Is there a way to expand the expression to the cells to the right?

I apologize for not uploading a mini-sheet but I am on a Gov work computer which blocks such things...

1677077195786.png


Thank you so much for assisting in this.
 
Upvote 0
yes. I highlighted the row with the time 2 out audited.
But, the cond format formula can be adjusted to look at other time out columns and only highlight the time out being audited.
I'm not sure if it will also highlight the name, though. I'll post in a bit.
 
Upvote 0
Okay, here it is. You can probably highlight the name by doing some kind of concatenation.
Notice that I had to put a check to see if the "Out" time is not blank before any condition of the In Time is done.
Even though it looks like I did 4 cond format formulas, I only did the cond formatting for cell C2, then copied its formatting everywhere else.

Mr Excel 8.xlsm
ABCDEFGHIJK
1NameOut(1)In(1)Out(2)In(2)Out(3)In(3)Out(4)In(4)2023-02-22 10:26
2Name 108:25:0010:01:5209:26:3310:40:2509:11:2510:22:1008:11:5409:25:37
3Name 209:16:1309:38:1609:13:4210:27:2508:37:0209:12:1709:38:16
4Name 309:50:0809:54:3808:35:2910:14:1509:56:2308:09:3109:15:27
5Name 408:30:1309:34:0409:25:5210:20:3209:22:00
6Name 509:30:3309:42:1808:40:5211:04:3810:04:58
7Name 608:46:2910:07:2209:56:4308:55:26
8Name 709:36:4909:01:4709:00:2508:55:0509:34:07
9Name 809:19:2709:42:2409:39:4208:55:2009:45:51
10Name 909:49:4109:59:41
11Name 1009:26:4408:26:29
12Name 1109:19:3509:27:2509:13:48
Sheet3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I2:I12Expression=IF(ISBLANK(I2)=FALSE,AND(ISBLANK(J2),($K$1-INT(I2))>=(I2-INT(I2)+(1/24))))textNO
G2:G12Expression=IF(ISBLANK(G2)=FALSE,AND(ISBLANK(H2),($K$1-INT(G2))>=(G2-INT(G2)+(1/24))))textNO
E2:E12Expression=IF(ISBLANK(E2)=FALSE,AND(ISBLANK(F2),($K$1-INT(E2))>=(E2-INT(E2)+(1/24))))textNO
C2:C12Expression=IF(ISBLANK(C2)=FALSE,AND(ISBLANK(D2),($K$1-INT(C2))>=(C2-INT(C2)+(1/24))))textNO
 
Upvote 0
Solution
Okay, here it is. You can probably highlight the name by doing some kind of concatenation.
Notice that I had to put a check to see if the "Out" time is not blank before any condition of the In Time is done.
Even though it looks like I did 4 cond format formulas, I only did the cond formatting for cell C2, then copied its formatting everywhere else.

Mr Excel 8.xlsm
ABCDEFGHIJK
1NameOut(1)In(1)Out(2)In(2)Out(3)In(3)Out(4)In(4)2023-02-22 10:26
2Name 108:25:0010:01:5209:26:3310:40:2509:11:2510:22:1008:11:5409:25:37
3Name 209:16:1309:38:1609:13:4210:27:2508:37:0209:12:1709:38:16
4Name 309:50:0809:54:3808:35:2910:14:1509:56:2308:09:3109:15:27
5Name 408:30:1309:34:0409:25:5210:20:3209:22:00
6Name 509:30:3309:42:1808:40:5211:04:3810:04:58
7Name 608:46:2910:07:2209:56:4308:55:26
8Name 709:36:4909:01:4709:00:2508:55:0509:34:07
9Name 809:19:2709:42:2409:39:4208:55:2009:45:51
10Name 909:49:4109:59:41
11Name 1009:26:4408:26:29
12Name 1109:19:3509:27:2509:13:48
Sheet3
Cells with Conditional Formatting
CellConditionCell FormatStop If True
I2:I12Expression=IF(ISBLANK(I2)=FALSE,AND(ISBLANK(J2),($K$1-INT(I2))>=(I2-INT(I2)+(1/24))))textNO
G2:G12Expression=IF(ISBLANK(G2)=FALSE,AND(ISBLANK(H2),($K$1-INT(G2))>=(G2-INT(G2)+(1/24))))textNO
E2:E12Expression=IF(ISBLANK(E2)=FALSE,AND(ISBLANK(F2),($K$1-INT(E2))>=(E2-INT(E2)+(1/24))))textNO
C2:C12Expression=IF(ISBLANK(C2)=FALSE,AND(ISBLANK(D2),($K$1-INT(C2))>=(C2-INT(C2)+(1/24))))textNO
Great, thank you- let me play with it.... Works really well, should be able to build Row2 and copy down for the other Rows.

Thank you soooo much! Super helpful!
 
Upvote 0
Copying rows down will work, if you include copy formatting as part of the paste.
Happy to help!
 
Upvote 0

Forum statistics

Threads
1,223,228
Messages
6,170,871
Members
452,363
Latest member
merico17

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