+ Reply to Thread
Results 1 to 16 of 16

Adding time to a date function

  1. #1
    Registered User
    Join Date
    01-07-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    63

    Adding time to a date function

    Hi

    I have a data set, and I made a table to pull out daily data. I have a start day and an end day usually the next day


    What I wrote for the Start was: =Date(Year(today())-1,1,2) and this gives me 1/2/2022 the start date and time are working as needed

    Then, I wrote for the End Date was =Date(Year(today())-1,1,3) to give me 1/3/2022 , but this date is giving me data up to midnight on that day

    What I am wanting to do is have the data stop at the 1700 data cell

    Iam using 365

    Thank You so much for looking at the post and any help would be greatly appreciated

  2. #2
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Adding time to a date function

    I'm not sure I understand. I don't see anything in either =DATE(...) function that would return time information as well. Your description claims that you are getting time information for the 2 Jan date, but not for the 3 Jan date. I cannot replicate that result based on what you wrote.

    I would expect a formula that returns both date and time in this fashion would look something like =DATE(2022,1,2)+TIME(6,24,33) to return 2 Jan 2022 at 6:24:33 AM.

    A sample file showing what you currently have might help us understand better.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  3. #3
    Registered User
    Join Date
    01-07-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    63

    Re: Adding time to a date function

    Hello

    See attached
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Adding time to a date function

    I still don't understand what you are trying to do. You talk about sorting, and your list appears correctly sorted in ascending order, first by date, then by time. You also say something about have the end date end at 17:00. Are you now wanting to filter the list so that you don't see the times after 17:00? On all days or only the last day? Or something else?

  5. #5
    Registered User
    Join Date
    01-07-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    63

    Re: Adding time to a date function

    yes that is correct I want to see only the data upto the 1700 on 1/3/22

    The dataset on the left is sorted from a 11000 line data set,
    that is a small sample of the dates indicated on the right
    That sample on the left is from the formulas on the right 3rd line up 1/2/2022 is sorted from the large set and gives me the 1/2/22 start date the formula for 1/3/22 shows data through midnight on 1/3/22,
    I wanted that time to end on 1700 hour of 1/3/22 not at midnight

  6. #6
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP and 2007
    Posts
    15,829

    Re: Adding time to a date function

    I can't see in your sample file where or how you intend to do the filter step. If I assume you are going to use Autofilter for this (because that is the easiest filter that my older version supports):

    1) I'm going to want a column in the main list that combines date and time together, so I add a column (I used column B) and add the formula =SUM(C7:D7) and copy/paste/fill to the bottom of the list.
    2) set up the autofilter
    3) In the date+time dropdown (on column B), I bring up the filter menu, tell it I want to find "between," then fill out the form to find date+time that is after 1/2/2022 04:00 and before 1/3/2022 17:00. List is filtered according to those criteria.

    Anytime I want to filter the list by two date/time, I bring up the filter menu in the appropriate column and specify the filter criteria.

    If you prefer, your newer version should be able to use the FILTER() function to do the same thing: https://support.microsoft.com/en-us/...c-4877ad80c759

    Does that help?

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Adding time to a date function

    Try:

    =LET(A,C7:F1000,B,FILTER(A,INDEX(A,,3)<>0),C,INDEX(B,,1)+INDEX(B,,2),VSTACK(C6:F6,FILTER(B,(C>=N17)*(C<=O17))))

    Refer to the file. I may have added some rows/columns...
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  8. #8
    Registered User
    Join Date
    01-07-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    63

    Re: Adding time to a date function

    That is great , but to go further, I should have mentioned the drop down and the data validation

    Your knowledge is greatly appreciated See attached
    Attached Files Attached Files

  9. #9
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Adding time to a date function

    Are you wanting a FORMULA, or are you wanting to use the advanced filter?

    It is beginning to sound like you want to use the advanced filter... as it LOOKS like the OUTPUT data are to be in the same place as the INPUT data.

    Please clarify. I'm not very good with Advanced Filter, so if that's what you want, I will step aside.

  10. #10
    Registered User
    Join Date
    01-07-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    63

    Re: Adding time to a date function

    I m thinking a formula on the right side table I do have data validation on the drop down list on the top left
    Thank You

  11. #11
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Adding time to a date function

    Show me what you expect to see as the result.

  12. #12
    Registered User
    Join Date
    01-07-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    63

    Re: Adding time to a date function

    Currently and this is working the data set on the left
    Has a filter function calling the large database
    As I click the the data validation drop down
    It pulls the date and time from the table on the right
    This all works but when I go to individual days
    It pulls all the day data I m wanting it to stop at 1700 hour

  13. #13
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Adding time to a date function

    So what is on the sheet is the filtered result.... from the raw data that is not included in the sample?????

    when you say filter function... do you mean a FORMULA.... =FILTER(something) or what?

    If yes, then we need to see some more of the raw data. If no, please explain. I am totally bewildered by your (non)-explanation.

  14. #14
    Registered User
    Join Date
    01-07-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    63

    Re: Adding time to a date function

    The argument I have for the day (table on the right) is pulling all the day data
    Up to midnight I guess excel figures the value of end dat to the
    Midnight hour
    I would like to have the end date stop it’s time before the midnight
    Hour

  15. #15
    Registered User
    Join Date
    01-07-2023
    Location
    USA
    MS-Off Ver
    365
    Posts
    63

    Re: Adding time to a date function

    yes that is filtered from a large database

  16. #16
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,055

    Re: Adding time to a date function

    Where are the raw data? If you want to modify a formula to pull data from place X to place Y... we need a sample of raw data.



    The formula I gave you:

    =LET(A,C7:F1000,B,FILTER(A,INDEX(A,,3)<>0),C,INDEX(B,,1)+INDEX(B,,2),VSTACK(C6:F6,FILTER(B,(C>=N17)*(C<=O17))))

    was designed to work on raw data in columns C to F. If that is NOT the rawe data, we need to know WHERE IT IS.

    (in response to your PM) This is why I don't take on private commissions for this sort of thing. Unless you make it 100% clear and 100% POSSIBLE, I'll be walking away from this thread.

    No more guessing games.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] sumproduct adding date to time range only works for same date
    By mlan in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 04-04-2021, 12:44 PM
  2. [SOLVED] Adding business days and time to a specific date and time
    By amitmodi_mrt in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-05-2019, 03:32 AM
  3. adding date and time and subtracting date-time2 from date-time1
    By tinkerbelle in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-22-2018, 10:05 AM
  4. Adding time (more than 24 hours) to date time stamp
    By sidapt in forum Excel General
    Replies: 6
    Last Post: 01-06-2014, 04:08 AM
  5. Adding elapsed time to date/time format over 24h
    By KimSenger in forum Excel General
    Replies: 1
    Last Post: 04-02-2013, 06:28 AM
  6. Adding Time to a Date & Time (using workdays only)
    By Buks in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-18-2009, 10:31 AM
  7. [SOLVED] Adding time to date-time formatted cell
    By tawtrey(remove this )@pacificfoods.com in forum Excel General
    Replies: 4
    Last Post: 08-12-2005, 06:05 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1