Excel Split Date Time Into Columns For Date And Then Time Episode - 2666

If you like this content, please consider visiting the video on YouTube and subscribe to the MrExcel Channel to show your support!
This video has been published on Jan 28, 2025.
Microsoft Excel Tutorial: Split Date Time into Columns for Date and then Time.

In this video, we tackle an intriguing Excel challenge from a real-world job interview scenario. Imagine being asked to split a column of date and time into separate date and time fields, build a pivot table, and create a report limited to certain conditions—class equals 1 and days are Tuesday or Thursday. Sounds tricky, right? Let’s break it down step by step and explore multiple approaches!

First, we’ll discuss how to split the date and time using simple formulas like =INT(A2) for the date and =A2-D2 for the time, along with proper formatting tips. Then, we’ll dive into creating a pivot table that reports by date instead of date and time. We’ll even explore grouping data by days and removing time elements directly within the pivot table.

But wait—what if Power Query is the better tool for this? We’ll walk through how to use Power Query to transform the data, removing the time component seamlessly, and setting up a new pivot table. Power Query is a game-changer for cleaning and reshaping data!

When it comes to filtering by weekday, we’ll show a smart trick using the =TEXT() function to extract the day name directly from the date, making it easier to filter for Tuesdays and Thursdays. Finally, we’ll combine it all with slicers to create an interactive, professional report.

Do you have a favorite method for these tasks? Would you handle this job interview challenge differently? Share your thoughts in the comments below! Don’t forget to like, subscribe, and hit the bell icon for more Excel tips and tricks from MrExcel!

Buy Bill Jelen's latest Excel book: MrExcel 2024 Igniting Excel

Table of Contents
(0:00) Three interview questions about Excel Pivot Tables
(0:40) Excel stores date before decimal and time after decimal
(1:01) Formulas to split date and time in Excel
(1:55) Grouping Date/Time field to just Date in Pivot Table
(2:40) Excel Power Query to convert Date/Time to Date for pivot table
(3:21) Converting Date to Weekday using TEXT function in Excel
(4:40) Slicers to filter a pivot table in Excel
(5:10) How would you solve this?


This video answers these questions:
Split date and time in Excel
Excel pivot table by date only
Remove time from date in Excel
Excel formulas for date and time
Create pivot table with weekday filter
Power Query to separate date and time
Filter Excel pivot table by weekday
Use TEXT function for weekday in Excel
Excel job interview pivot table test
Advanced Excel pivot table tricks
maxresdefault.jpg


Transcript of the video:
Oh, I've got a good one today. Alright, we have a column that has date.
And time and we want to split that into date and then time.
And I knew that this was going to be simple, but now I'm second guessing myself.
A neighbor of mine went on a job interview. The hiring manager loves pivot tables.
They want to make sure this person can do pivot tables.
They had them do a hands-on test. Can you build a pivot table?
How to report by date instead of date and time?
And then limit the report to class equals one and the day is Tuesday or Thursday. That makes it really hard.
Okay, so my initial reaction was we have to attack number two first, right?
And I showed the person how this date and time…. If we go into Show Formulas mode.
Is really a serial number date.
The number of days elapsed since January 1st, 1900.
And then the time is the fraction of the day after that decimal point. And so I said it's two weird formulas.
To get the date, we're going to take A2 and we're going to truncate it or take the INT of it.
So equal INT of A2. And that may not be formatted correctly.
So we have to come up here and change it to a Short Date.
And then to get the time, well actually, now that we already have the date, it's just simple.
It's A2 minus D2. Definitely it won't be formatted correctly.
But we can come in here and format that as a time.
And so now we have it broken out that the date is there and the time is there. And now we're free to go create that pivot table.
But then it's just weird that they asked for question one, can you build a pivot table?
And then how to report by date instead of date and time.
And now I'm starting to wonder if what they wanted the person to be able to do.
Would be to build the pivot table first. Insert, Pivot Table.
Go ahead and go to a new worksheet. Put the dates down the left hand side.
And they're going to show up as date and time.
And then whatever we're going to put in the values area.
And then we can with the first date or that heading selected, either one.
Come here and Group Field. And say we want to group it to just days.
That's a very clever way to take that time and just remove it, right?
So if we click okay, then we get a new field called Days Date.
Which is just the dates. And the times are gone.
What do you think? Is that what they were looking for?
Or were they trying to do some power query? Where we take this data.
Make it into a table with control T. And then Data, from Table or Range.
And then in Power Query. We can come here under Transform.
And say that it's just a straight date that will remove the times.
And now we're free to create our pivot table. Home, Close and Load, Close and Load To.
And we're going to create a pivot table report.
And then the date field will automatically be the date. So there's a couple of different ways to go.
And I guess if it wasn't for question number three.
Llimit the report to class one and Day is Tuesday or Thursday.
See that Tuesday or Thursday? That makes this a real pain, right?
Because then I need to somehow get the weekday out of this.
And I know we have the WEEKDAY function.
But I actually hate using WEEKDAY because I can never. Because I can never remember what the returns are.
It's like one is Sunday. So later, am I ever going to remember that?
That means that two is Monday. Three is Tuesday.
So I need the threes and the fives to get the Tuesdays and Thursdays.
This is just too confusing to me.
So what I always do is I use the equal TEXT function of that date. And I ask for it in DDDD format.
You could also use three Ds there if you wanted the abbreviation.
And that will give you the day of the week.
Alright, see now that I have date, time, and weekday. Now if we create a pivot table.
Insert, Pivot Table. Click okay.
We can put the totals here in values. We can, put the dates down the side.
Classes across the top. And then add a slicer in.
And then add a Slicer for a weekday and class. Click okay.
And we'll choose Tuesday. And then control click on Thursday.
That'll get just the Tuesday and Thursday dates. And then what was the class?
Class is equal to one. So just one there.
And so there's our answer of the 9,064. Yeah.
So what do you think? For all my regular viewers out there.
If you were heading into an interview. And you've got these questions.
How do you think that they are trying to limit the report by date instead of date and time?
Do you think that they're trying to see if you know these formulas to get the integer of A2?
Or do you have a better way to get the date? And then for reporting by weekday.
Or at least getting just the Tuesdays and Thursdays.
Would you use the TEXT function here or something else?
Let me know down in the YouTube comments. Well hay, I want to thank you for stopping by.
We'll see you next time for another netcast from MrExcel.
 
How should a candidate answer such a question? How should a company phrase such questions when there may be many ways to secure answers?

MrExcel video Pivot table showing Tuesdays and Thursdays
www.mrexcel.com/board/threads/excel-split-date-time-into-columns-for-date-and-then-time-episode-2666.1269234/e Excel Split Date Time Into Columns For Date And Then Time Episode - 2666
"In this video, we tackle an intriguing Excel challenge from a real-world job interview scenario. Imagine being asked to split a column of date and time into separate date and time fields, build a pivot table, and create a report limited to certain conditions—class equals 1 and days are Tuesday or Thursday."
The interview question may communicate information on the company which may or may not be true. In my opinion, it is more important to know if the candidate could secure the required information from the data than if he knows how to secure it with a Pivot Table.
It may or may not help in an interview but the candidate could state that a Pivot Table is not required. Quote from Albert Einstein "Make everything as simple as possible, but not simpler."
We could use a formula such as sum or Groupby; Groupby requires a current version of Excel. We can also sort with Excel's custom list DOW.

T202501a.xlsm
ABCDEFG
1Date and TimeAmount
2Thu 16-Jan-25 00:00120DOWNumAmount
3Thu 16-Jan-25 06:00122Tue81,528
4Thu 16-Jan-25 12:00124Thu122,148
5Thu 16-Jan-25 18:00126
6Fri 17-Jan-25 00:00128DOWNumAmount
7Fri 17-Jan-25 06:00130Tue81,528
8Fri 17-Jan-25 12:00132Thu122,148
9Fri 17-Jan-25 18:00134
10Sat 18-Jan-25 00:00136
11Sat 18-Jan-25 06:00138 SUMAVERAGECOUNTA
12Sat 18-Jan-25 12:00140Tue1,5281918
13Sat 18-Jan-25 18:00142Thu2,14817912
14Sun 19-Jan-25 00:00144
8e
Cell Formulas
RangeFormula
E3E3=SUM(--(WEEKDAY(A2:A65)=3))
F3F3=SUM((WEEKDAY(A2:A65)=3)*B2:B65)
E4E4=SUM(--(WEEKDAY(A2:A65)=5))
F4F4=SUM((WEEKDAY(A2:A65)=5)*B2:B65)
E7E7=LET(a,FILTER(A2:B65,WEEKDAY(A2:A65)=3),COUNTA(CHOOSECOLS(a,2)))
F7F7=LET(a,FILTER(A2:B65,WEEKDAY(A2:A65)=3),SUM(CHOOSECOLS(a,2)))
E8E8=LET(a,FILTER(A2:B65,WEEKDAY(A2:A65)=5),COUNTA(CHOOSECOLS(a,2)))
F8F8=LET(a,FILTER(A2:B65,WEEKDAY(A2:A65)=5),SUM(CHOOSECOLS(a,2)))
D11:G13D11=LET(a,VSTACK(FILTER(A2:B65,WEEKDAY(A2:A65)=3),FILTER(A2:B65,WEEKDAY(A2:A65)=5)),GROUPBY(TEXT(INT(CHOOSECOLS(a,1)),"ddd"),CHOOSECOLS(a,2),HSTACK(SUM,AVERAGE,COUNTA),,0,-1))
A3:A14A3=A2+0.25
Dynamic array formulas.
 
Last edited:

Forum statistics

Threads
1,226,059
Messages
6,188,634
Members
453,487
Latest member
LZ_Code

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