VBA - Date vs Time

hwelshim

New Member
Joined
Nov 12, 2020
Messages
7
Office Version
  1. 365
Platform
  1. Windows
I receive a lot of reports that generate the date above the time. It then lists lots of times for logging in and logging out. Then it will list the next date followed by lots of times. When I select the cell with times, the date isn't present. I need to sort by date. I'm thinking there's an if statement I can write that recognizes the date and then inserts the date in a column next to the time column. I've tried ISDATE, but it recognizes time as TRUE. Any other ideas? Thank you all a lot!
 

Attachments

  • Untitled.png
    Untitled.png
    175.8 KB · Views: 13

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.
Hi *aRandomHelper, this looks super promising. The problem is when I input into my sheet, it triggers the error every time so I have "Date" going all the way down column A. Here's a weird thing though: when I delete the 1 from 2021, it works. It lists 1/22/202 and 1/23/202, but as soon as I make a proper date again, triggers the error. Any ideas?
 
Upvote 0
I don't quite get it, can you show what you have so far with XL2BB?
Sure thing:
For Dave's problem.xlsx
ABC
1DateTimeIn/Out
2Date1/22/2021Out
3Date21:34:35In
4Date23:52:46In
5Date04:44:01Denied
6Date23:41:52Out
7Date20:21:36In
8Date1/23/2021
9Date14:26:50In
10Date11:31:39Denied
11Date23:27:12In
12Date15:20:40Out
13Date08:19:08In
14Date20:17:02Out
15Date07:03:16Out
16Date07:33:38Denied
17Date00:16:49Out
Sheet1
Cell Formulas
RangeFormula
C2:C7,C9:C17C2=CHOOSE(RANDBETWEEN(1,3),"In","Out","Denied")
A2:A17A2=IF(ISERROR(INT(B2)),B2,A1)
 
Upvote 0
=IF(B3<1,A2+B3,B3)
Hi Dave, thanks for your help. This seems really close, but I'm having a hiccup I can't figure out. The time keeps triggering the False option. Any ideas why? Thanks again!
For Dave's problem.xlsx
ABC
1DateTimeIn/Out
21/22/20211/22/2021Out
320:17:0220:17:02Denied
420:17:0320:17:03In
520:17:0420:17:04Denied
620:17:0520:17:05Out
720:17:0620:17:06Out
81/23/20211/23/2021
914:26:5014:26:50In
1011:31:3911:31:39Denied
1123:27:1223:27:12Out
1215:20:4015:20:40Denied
1308:19:0808:19:08Out
1420:17:0220:17:02In
1507:03:1607:03:16In
1607:33:3807:33:38Denied
Sheet1
Cell Formulas
RangeFormula
C2:C7,C9:C16C2=CHOOSE(RANDBETWEEN(1,3),"In","Out","Denied")
A2A2=B2
A3:A16A3=IF(B3<1,A2+B3,B3)
 
Upvote 0

Forum statistics

Threads
1,214,520
Messages
6,120,011
Members
448,935
Latest member
ijat

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