+ Reply to Thread
Results 1 to 6 of 6

Excel Date Range, adding zero value in missing date

  1. #1
    Registered User
    Join Date
    04-06-2013
    Location
    India
    MS-Off Ver
    Excel 2019
    Posts
    14

    Excel Date Range, adding zero value in missing date

    Hi,
    I have an excel with Date column (with missing date) and value column. I have to fill the missing dates in the Date column with zero. Also, if same date in repeated with more than once, it should be consolidate with one date instance and the relevant values should be summed up with single value. And the series to be continued till the end of the month.

    Attached the excel with Date column and Value column.
    Attached Files Attached Files
    Last edited by satish12334; 11-01-2024 at 02:38 PM.

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Excel Date Range, adding zero value in missing date

    Your dates in column A are not real dates - they are text values which look like dates, and as such you can't do any arithmetic directly on them. Can the process which creates the two columns be easily modified to return the dates correctly?

    Hope this helps.

    Pete

  3. #3
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: Excel Date Range, adding zero value in missing date

    Try in F3, copy down: =SUMIFS(B$3:B$100,A$3:A$100,E3)

  4. #4
    Forum Expert
    Join Date
    01-05-2013
    Location
    Singapore
    MS-Off Ver
    H&B2019
    Posts
    4,542

    Re: Excel Date Range, adding zero value in missing date

    @Pete, SUMIFS or SUMIF can pick up the text-dates correctly as long as they are in the correct format.

  5. #5
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Excel Date Range, adding zero value in missing date

    You can use the following formula in cell D3 (note that I have inserted a few columns so that you can compare my solution with what you had prepared manually):

    =MIN(--(A3:A31))

    This is an array formula, so if you are using Excel 2019 as you profile states then you need to confirm the formula using the key combination of Ctrl-Shift-Enter (CSE) instead of the usual Enter. If you are using a later version of Excel then the CSE is not required.

    Format the cell as a date in the style you prefer, and then use this formula in D4:

    =D3+1

    Copy this down to cell D30 (which will be the 28th of the month if you start with the 1st of the month). You can then use this formula in D31:

    =IF(D30="","",IF(MONTH(D30+1)=MONTH(D30),D30+1,""))

    and copy this down to D33, which will then cope with months that are longer than 28 days.

    You can then use this formula in E3:

    =IF(D3="","",SUMPRODUCT(--($A$3:$A$33=TEXT(D3,"dd/mm/yyyy")),($B$3:$B$33*1)))

    and copy this down to E33. If you want to show the individual contributions to your totals, as in your sample file, then you can use this array* formula in F3:

    =IF(D3="","",TEXTJOIN("+",TRUE,IF($A$3:$A$33=TEXT(D3,"dd/mm/yyyy"),$B$3:$B$33,"")))

    * You need to commit this formula using CSE, as previously advised, and then you can copy down to F33.

    The attached file shows this in operation.

    Hope this helps.

    Pete
    Attached Files Attached Files

  6. #6
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,411

    Re: Excel Date Range, adding zero value in missing date

    Quote Originally Posted by josephteh View Post
    @Pete, SUMIFS or SUMIF can pick up the text-dates correctly as long as they are in the correct format.
    Yes, I know, but I wanted this to be dynamic (by using the MIN function to find the starting date), and so it needed to be proper dates. All the missing dates have to be generated as well - you have assumed them to exist in column E. Thanks for making the point, though.

    Pete

+ 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. Coloring cells based on date range and adding a shape at a certain date
    By moomphas in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 05-23-2018, 05:17 AM
  3. Excel Macro to find missing dates and insert missing date as blank row
    By JevaMarie in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-26-2013, 11:08 AM
  4. [SOLVED] find missing date on every group date list based on range and criteria
    By k1dr0ck in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2013, 01:26 AM
  5. Replies: 1
    Last Post: 10-02-2012, 02:42 PM
  6. Adding years to a date, but leaving blank if no date in the original cell.
    By buddyhackit9 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 12-12-2011, 01:17 AM
  7. Replies: 1
    Last Post: 04-26-2008, 08:00 AM

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