+ Reply to Thread
Results 1 to 23 of 23

Calculate pro rated value using the number of days of the month enrolled

  1. #1
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Calculate pro rated value using the number of days of the month enrolled

    The attached example contains two key variables: Column A (ENROLL DATE) and a value that represents KWH usage.

    I would like to calculate a pro rated KWH based on the date enrolled.

    If a customer enrolled March 16 in which there are 31 days the formula will use the KWH for the month of March (the month enrolled) and calculate the pro rated useage based on March having 31 days, but the customer enrolling March 16 (half way through the month).

    The formula would need to reference the ENROLL DATE cell and then the enroll date month KWH which are the other columns B through W to do the calculation.

    Since next year is a leap year, I would think that the year might need to be a factor when determining the number of days in a month.

    I am hoping that this is all clear. Again, I have attached a spreadsheet for this.

    Thank you in advance - any help is greatly appreciated.
    Attached Files Attached Files
    Last edited by Hedy; 10-29-2019 at 10:48 AM. Reason: updated spreadsheet

  2. #2
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Calculate pro rated value using the number of days of the month enrolled

    Change your months in B1:W1 to actual dates and add desired results, even if manually in X column first. That way, we won't guess.
    Click the * to say thanks.

  3. #3
    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
    43,984

    Re: Calculate pro rated value using the number of days of the month enrolled

    Row 2.... so this customer was using up kWH for 2.5 month before enrolling???
    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

  4. #4
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Calculate pro rated value using the number of days of the month enrolled

    Those are not dates, the KWH (kilowatt hour usage)

    I am trying to get the number of KWH usage using the KWH values in those cells. Whatever the enroll date is for example March, then the formula will use the KWH value for March.

  5. #5
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Calculate pro rated value using the number of days of the month enrolled

    Row 2:
    Customer enrolled March 16, 2018, so their KWH needs to be pro rated for that month (the month enrolled). Their KWH usage for March is 14400. There are 31 days in March and the customer enrolled March 16, so their pro rated usage would be calculated based on March 16 to March 31.

  6. #6
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Calculate pro rated value using the number of days of the month enrolled

    If you make the change I asked above, then use: =SUMPRODUCT(--(MONTH($B$1:$W$1)=MONTH($A2)),--(YEAR($B$1:$W$1)=YEAR($A2)),$B2:$W2)/DAY(EOMONTH($A2,0))*DAY($A2)

  7. #7
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Calculate pro rated value using the number of days of the month enrolled

    but those other values are not dates - they are kilowatt hour values

  8. #8
    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
    43,984

    Re: Calculate pro rated value using the number of days of the month enrolled

    Clearly there is some anbiguity in your request. This seems logical to me and is completely different to Paul's effort.

    =INDEX($B2:$W2,MATCH(EOMONTH($A2,-1)+1,$B$1:$W$1,0))*DAY(EOMONTH(LOOKUP(A2,$B$1:$W$1,$B$1:$W$1),0))/DAY(A2)

    It also requires chnages to the dates in row 1 to make them real dates (see sheet). You were asked to (but didn't...)manually calculate a few results. You will now need to do so to see who (if either) is correct!!
    Attached Files Attached Files

  9. #9
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Calculate pro rated value using the number of days of the month enrolled

    For each month (column heading) and for each row (customer account) there are kilowatt hours used (those are the values in the cells from B2 to W24).

  10. #10
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Calculate pro rated value using the number of days of the month enrolled

    I am talking about the months in B1:W1, not all data

  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
    43,984

    Re: Calculate pro rated value using the number of days of the month enrolled

    The stuff in row 1 is a date is it not? That's what we're talking about.

  12. #12
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Calculate pro rated value using the number of days of the month enrolled

    I just added an updated version of the spreadsheet to the original post.

  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
    43,984

    Re: Calculate pro rated value using the number of days of the month enrolled

    It's worse. PLEASE do as you were asked. Calculate manually the expected result for a few rows. Compare with the results in my sheet and using the formula given by Paul.

  14. #14
    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
    43,984

    Re: Calculate pro rated value using the number of days of the month enrolled

    The data in row 2 and down are kWH. However, they relate to months (DATES) in row 1. The headers need to be converted to REAL dates (not text that simply looks like a date).

    Do me a favour. Open the sheet I posted. Does it give you the correct result or not???

  15. #15
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Calculate pro rated value using the number of days of the month enrolled

    Sorry - I posted the updated spreadsheet almost at the same time. I compared all three (my calculation is one of them).

    For row 1 the customer enroll date is 2/16/18 (28 days in February 2018). The enroll month of February that customer used 13500 KWH of energy. So I divided 13500 of usage by 28 days to get 482 KWH of usage per day in Feb 2018 and multiplied this by 12 (28 days in Feb 2018 and the customer enrolled Feb 16).

    All three sets of numbers are different.

  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
    43,984

    Re: Calculate pro rated value using the number of days of the month enrolled

    Right. That is (I think) what my formula gives. Check it out.

  17. #17
    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
    43,984

    Re: Calculate pro rated value using the number of days of the month enrolled

    Ah wait . I understand now. Life would be so much easier if you actually supplied us with two or 3 manually calculated results.

  18. #18
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Calculate pro rated value using the number of days of the month enrolled

    for row 1 your calculation gave me 23625 and my calculation gave me 5785

    13500 (FEB KWH) / 28 (days in Feb 2018) = 482 KWH per day

    482 (KWH per day) *12 (difference of 28 days and Feb 16 enrollment) = 5785

    Sorry - just saw your other message, I will make sure to provide manual results next time - again I am so sorry! This was a tough question for me to try and write clearly.

  19. #19
    Forum Expert PaulM100's Avatar
    Join Date
    10-09-2017
    Location
    UK
    MS-Off Ver
    Office 365
    Posts
    2,108

    Re: Calculate pro rated value using the number of days of the month enrolled

    My formula will do exactly what you wrote above, the result/number of days in month * by the starting date
    =SUMPRODUCT(--(MONTH($B$1:$W$1)=MONTH($A2)),--(YEAR($B$1:$W$1)=YEAR($A2)),$B2:$W2)/DAY(EOMONTH($A2,0))*DAY($A2)

  20. #20
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Calculate pro rated value using the number of days of the month enrolled

    It is close to the result I get when I do the calculation manually, but for instance for

    row 2 I get 5785 and your calculation gives 7714.
    row 3 I get 14468 and your calculation gives 14286
    row 4 I get 5280 and your calculation gives 4036

    Not sure why the difference

  21. #21
    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
    43,984

    Re: Calculate pro rated value using the number of days of the month enrolled

    This gives 5785:
    =(DAY(EOMONTH(LOOKUP(A2,$B$1:$W$1,$B$1:$W$1),0))-DAY(A2))*INDEX($B2:$W2,MATCH(EOMONTH($A2,-1)+1,$B$1:$W$1,0))/DAY(EOMONTH(LOOKUP(A2,$B$1:$W$1,$B$1:$W$1),0))

    However, I think your logic is faulty. Change A2 to 1/2/2018. Is the result really expected to be 13017.

    I think you really want this:
    =(DAY(EOMONTH(LOOKUP(A2,$B$1:$W$1,$B$1:$W$1),0))-DAY(A2)+1)*INDEX($B2:$W2,MATCH(EOMONTH($A2,-1)+1,$B$1:$W$1,0))/DAY(EOMONTH(LOOKUP(A2,$B$1:$W$1,$B$1:$W$1),0))

  22. #22
    Forum Contributor
    Join Date
    05-01-2013
    Location
    Richmond, VA
    MS-Off Ver
    Excel 365
    Posts
    164

    Re: Calculate pro rated value using the number of days of the month enrolled

    So, I am looking at your spreadsheet and just manually calculated row 13 with an enroll date of March 27, 2018. KWH for March was 4349

    With March having 31 days, I divided 4349 by 31 = 140 KWH per day

    Then I multiplied 140 KWH per day by 4 for (March 31 - March 27)

    The pro rated KWH used would be 561 - right? That is what your first formula gives me. The second formula you gave me gives the result of 701, which is multiplying using an additional day.

    I see what you are saying such that you are counting the day enrolled, not from the day enrolled, which is probably the correct way to do this.

    I think I have my formula.

    Thank you so very much!

  23. #23
    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
    43,984

    Re: Calculate pro rated value using the number of days of the month enrolled

    Yep. And if you set a date to the last day of the month it gives just 1 day's worth of usage.

    Phew!!!

    You're welcome!!!

+ 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] calculate the number of days in a month through 'Month Name'
    By pipsmultan in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-30-2017, 03:10 PM
  2. How to calculate number of days between two dates by month
    By MHayward in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 04-06-2015, 12:26 PM
  3. Trying to calculate a pro-rated membership cost based on a day of month
    By damianberry in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-31-2015, 12:47 AM
  4. [SOLVED] Calculate number of days in a month between two dates
    By schlomo87 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-04-2014, 12:32 AM
  5. Calculate the number of working days month wise in a given period using VBA
    By rakesh3235 in forum Hello..Introduce yourself
    Replies: 2
    Last Post: 08-21-2014, 07:00 AM
  6. [SOLVED] How to calculate Year, Month and Day from total number of days?
    By Indra Rai in forum Excel General
    Replies: 4
    Last Post: 06-25-2014, 02:08 PM
  7. Replies: 15
    Last Post: 06-03-2014, 02:08 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