+ Reply to Thread
Results 1 to 13 of 13

Carry over values from one month to the next

  1. #1
    Registered User
    Join Date
    08-26-2016
    Location
    Canada
    MS-Off Ver
    Microsoft 365
    Posts
    8

    Carry over values from one month to the next

    Hi, this is for a hotel application. My input data is a list of bookings which has a starting date (First night) and corresponding number of 'Total nights' stayed. I'd like to calculate the total number of days stayed in each month, but the problem occurs when a booking starts in one month and carries over into the next.

    My first thought was to add a column that calculates the number of days in the 'Starting month' and then have another column which is the balance of days which fall into the carryover month.

    Is it possible to make a pivot table from this that sums up all the nights for each month? (OR some other method that will have the same result).

    Thx
    Attached Files Attached Files
    Last edited by AmrithS; 08-26-2016 at 01:42 PM. Reason: Added workbook

  2. #2
    Forum Expert
    Join Date
    10-09-2012
    Location
    Dallas, Texas
    MS-Off Ver
    MO 2010 & 2013
    Posts
    3,049

    Re: Carry over values from one month to the next

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Please ensure you mark your thread as Solved once it is. Click here to see how.
    If a post helps, please don't forget to add to our reputation by clicking the star icon in the bottom left-hand corner of a post.

  3. #3
    Registered User
    Join Date
    08-26-2016
    Location
    Canada
    MS-Off Ver
    Microsoft 365
    Posts
    8
    Quote Originally Posted by mikeTRON View Post
    Attach a sample workbook. Make sure there is just enough data to demonstrate your need.
    Hi Mike, done (pls see original post). Let me know if there's any further clarification needed.

  4. #4
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Carry over values from one month to the next

    d17 =if($C17<=eomonth($A17,0),$C17-$A17,eomonth($A17,0)+1-$A17)

    e17 =B17-D17

    f17 =MONTH(A17)

    g17 =MONTH(C17)

    l17 =SUMIF($F$17:$F$20,L$16,$D$17:$D$20)+SUMIF($G$17:$G$20,L$16,$E$17:$E$20) and drag to the right.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  5. #5
    Registered User
    Join Date
    08-26-2016
    Location
    Canada
    MS-Off Ver
    Microsoft 365
    Posts
    8

    Re: Carry over values from one month to the next

    Thanks oeldere, your EOMONTH code really cleans up some of my interim steps, and will help since my source data is quite large


    Though I should have mentioned that I need the final result to be a pivot table. I simplified the input data table, but there's a lot of other fields that I need to analyze for, which can't be done with the SUMIF statement.



    What I'd like to do is make a pivot table, from two data sources for the same data type (i.e. month vs nights stayed), but they're both in different locations on the same table. Not sure if my problem definition makes sense

  6. #6
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Carry over values from one month to the next

    in that cade you should split the data into the 2 diffeant months on a diffeant row, then you will be able to make a pivot table of it.

    0/06/2016 - 31/06/2016
    01/07/2016 - 15/07/2016

  7. #7
    Registered User
    Join Date
    08-26-2016
    Location
    Canada
    MS-Off Ver
    Microsoft 365
    Posts
    8

    Re: Carry over values from one month to the next

    The data is an export from an external source, so I can't control how it's stored/displayed.

  8. #8
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Carry over values from one month to the next

    I22 =IF(INDIRECT("A"&(ROW()/2)+6)="","",INDIRECT("A"&(ROW()/2)+6))

    I23 =IFERROR(VLOOKUP(I22,Tabel1,3;0),"")

    The other cells are with VLookup.

    and both (together) drag down.

    After that a pivot table.

    See the attached file.

  9. #9
    Registered User
    Join Date
    08-26-2016
    Location
    Canada
    MS-Off Ver
    Microsoft 365
    Posts
    8

    Re: Carry over values from one month to the next

    Hi Oeldere, we have multiple check-ins per any given day (I just simplified the input table), hence there will be multiple line items for the same date, and VLOOKUP won't function.


    Is there any way to achieve this via a pivot table calculated field?

  10. #10
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Carry over values from one month to the next

    show the amend file, with all options.

    please add the expected result in your file.

  11. #11
    Registered User
    Join Date
    08-26-2016
    Location
    Canada
    MS-Off Ver
    Microsoft 365
    Posts
    8

    Re: Carry over values from one month to the next

    Hi Oeldere, please see attached.
    Attached Files Attached Files

  12. #12
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: Carry over values from one month to the next

    You sheet Result Ideal Layout is made (by you) with a pivot table.

    You want the result made by a pivot table, and already made one.

    I don't understand what the question is, you want me to solve.

  13. #13
    Registered User
    Join Date
    08-26-2016
    Location
    Canada
    MS-Off Ver
    Microsoft 365
    Posts
    8

    Re: Carry over values from one month to the next

    The report that I made only takes into account the start month data.

    So the data is incomplete because the "End month numbers" (i.e. bookings which started in the previous month and were carried over) are not included in the data set. It's between 3 & 25% of the monthly occupancy, so it's a pretty significant chunk of data.

+ 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] Carry Forward New YTD Values On A Reconciliation
    By picton2000 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-20-2016, 08:32 AM
  2. Replies: 0
    Last Post: 07-16-2013, 11:30 AM
  3. [SOLVED] Macro to copy the values so formula doesn't carry over
    By Gard5096 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-26-2012, 07:20 PM
  4. How to carry array values between userforms?
    By presmadagascar in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-27-2011, 03:08 PM
  5. Carry Values Right Of Decimal Pt to Another Location
    By bdb1974 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-26-2011, 04:04 PM
  6. Replies: 0
    Last Post: 12-15-2010, 03:42 PM
  7. how to change values to formula in VBA to carry out goal seek?
    By Desmond in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-18-2006, 08:35 AM

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