+ Reply to Thread
Results 1 to 5 of 5

display total sales at the end of each month from date-wise data

  1. #1
    Registered User
    Join Date
    05-10-2014
    MS-Off Ver
    Excel 2003
    Posts
    3

    display total sales at the end of each month from date-wise data

    Hello Everybody!
    I had tried to be as descriptive as possible in the title. My excel problem is this --

    Daily sales are recorded in column B against dates(dd/mm/yyyy) in column A.
    Sometimes there are more than one record of sale for a day, and sometimes no sale at all for another day.
    What I want is --

    In the column C, a blank is displayed whilst it still is the same month for sales records except for the last record where it should display the sum of all sales of that month till that point of time(date); and when the month changes, the total for all sales for the last month be displayed in the cell in column C against the last date for sales in the last month, and again blanks to be displayed against the advancing date-wise sale records except for the last one where it should display the total of sales in this new month till that point of time(date).

    For Example:--

    Date **** Amount **** CumulativeMonthlyAmount
    01-04-2014 **** 500
    02-04-2014 **** 1000
    02-04-2014 **** 1250
    09-04-2014 **** 200
    09-04-2014 **** 2000
    09-04-2014 **** 500
    09-04-2014 **** 800
    29-04-2014 **** 3600
    31-04-2014 **** 300 **** 12600
    01-05-2014 **** 2450
    08-05-2014 **** 1250
    18-05-2014 **** 900
    18-05-2014 **** 700
    30-05-2014 **** 4500 **** 9800
    03-06-2014 **** 1800
    06-06-2014 **** 2100
    06-06-2014 **** 300
    06-06-2014 **** 1000 **** 5200

    and if now I enter new Amount of 500 on 08-06-2014 in the next row, the 5200 in column C should disappear and 5700(=5200+500) should appear below it.


    To clarify: Number of cells carrying the same date, and also of those belonging to the same month is variable for each month.
    Can there be a nice and clean formula, instead of referencing and sub-referencing with data in hidden columns
    How to use the SUMIF, or COUNTIF, or OFFSET, MATCH, "", SUMPRODUCT, etc to solve this problem?

    Please help!
    Last edited by Ranjeet2001; 05-10-2014 at 11:40 AM. Reason: The data appeared jumbled up

  2. #2
    Forum Expert mrice's Avatar
    Join Date
    06-22-2004
    Location
    Surrey, England
    MS-Off Ver
    Excel 2013
    Posts
    4,967

    Re: display total sales at the end of each month from date-wise data

    You can do this with a helper column.

    Insert a column between B and C

    In the (now empty) C2 paste in

    =YEAR(A2)&LEFT("0",2-LEN(MONTH(A2)))& MONTH(A2)

    and copy down. This will give a year and month concatenated value

    In D2 paste in

    =IF(C2<> OFFSET(C2,1,0),SUMIFS(B:B,C:C,C2),"")

    and copy down. This does the sum for all rows with the same value in column C but only displays if the value in column C is different in the row below.
    Martin

  3. #3
    Valued Forum Contributor
    Join Date
    05-13-2010
    Location
    Belo Horizonte, Brazil
    MS-Off Ver
    Excel 2003; 2007
    Posts
    441

    Re: display total sales at the end of each month from date-wise data

    Ranjeet2001, Good afternoon.

    Try to use it:

    C2 -->
    =IF(MONTH(A2)<>MONTH(A3),SUMPRODUCT((MONTH($A$2:$A$19)=MONTH(A2))*($B$2:$B$19)),"")
    Copy it down.

    Is it what you want?
    I hope it helps.

    Have a nice weekend.
    ...If my answer helped you, Please, click on. * Add Reputation (at left)

    Best regards.
    Marc?lio Lob?o

  4. #4
    Registered User
    Join Date
    05-10-2014
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: display total sales at the end of each month from date-wise data

    Hello mrice,
    Thanks a lot for that. Though the formula you asked me to paste in C2 looked scary at first, I could figure out that it intended to keep month number in 2 digits!
    But can I ask if we could have simply written C3 instead of "OFFSET(C2,1,0)? Anyway thanks again!

    Quote Originally Posted by mrice View Post
    You can do this with a helper column.

    Insert a column between B and C

    In the (now empty) C2 paste in

    =YEAR(A2)&LEFT("0",2-LEN(MONTH(A2)))& MONTH(A2)

    and copy down. This will give a year and month concatenated value

    In D2 paste in

    =IF(C2<> OFFSET(C2,1,0),SUMIFS(B:B,C:C,C2),"")

    and copy down. This does the sum for all rows with the same value in column C but only displays if the value in column C is different in the row below.

  5. #5
    Registered User
    Join Date
    05-10-2014
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: display total sales at the end of each month from date-wise data

    Quote Originally Posted by Mazzaropi View Post
    Ranjeet2001, Good afternoon.

    Try to use it:

    C2 -->
    =IF(MONTH(A2)<>MONTH(A3),SUMPRODUCT((MONTH($A$2:$A$19)=MONTH(A2))*($B$2:$B$19)),"")
    Copy it down.

    Is it what you want?
    I hope it helps.

    Have a nice weekend.
    Hi Mazzaropi,
    This one seems even better; basically i like to avoid helper columns as much as possible!
    This was exactly what I wanted.
    In fact I was almost there with this formula, but I had used A:A, and B:B instead of the absolute reference. I still wonder if we could have kept the second letter relative like $A$2:A100. I tried and it seemed to work fine. Please tell if I am wrong generally and only this particular case holds true. Just a minor point!
    Thanks a ton anyway! Thanks

+ 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. Replies: 1
    Last Post: 11-19-2013, 12:52 PM
  2. Replies: 0
    Last Post: 04-09-2013, 09:36 AM
  3. Replies: 4
    Last Post: 08-28-2012, 01:31 AM
  4. Extract from the list and total month wise.
    By ebin charles in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-25-2011, 11:40 AM
  5. Plot data month-wise and month-wise
    By modest_16081982 in forum Excel Charting & Pivots
    Replies: 5
    Last Post: 10-08-2008, 04:44 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