+ Reply to Thread
Results 1 to 14 of 14

Excel formula for multiple data

  1. #1
    Registered User
    Join Date
    01-04-2018
    Location
    Lagos
    MS-Off Ver
    2016
    Posts
    19

    Excel formula for multiple data

    Hi everyone,

    This is my first post in this forum, so I'll start by thanking everyone in advance for your help!

    So basically I have an excel sheet that I keep adding data and I have some statistic following it. I have almost all of it automatic but I'm stuck in two points and I can't solve it. So here is the issue:

    We are a short term rental company and we add our clients info in order to keep our statistic of how many days in a month are sold and how much each month provided.
    The info we provide is we have the check in date, check out date, the full amount paid and the daily rate.
    By hand I'm seeing how many nights per month and how much. But obviously some people arrive at the end of the month and stay until next month. The check out day does not count as a stayed night since they don't sleep there.

    So I basically need two formulas. One to calculate how many nights in the month - consider that some guests arrive in one month and leave in the other and that the check-out date does not count as a night.

    The other formula to calculate how much money in a month - consider what is said above with the days and that we already have a daily rate.

    Thanks in advance!
    Luís

  2. #2
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Excel formula for multiple data

    Hi welcome to the forum

    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.
    Samba

    Say thanks to those who have helped you by clicking Add Reputation star.

  3. #3
    Registered User
    Join Date
    01-04-2018
    Location
    Lagos
    MS-Off Ver
    2016
    Posts
    19

    Re: Excel formula for multiple data

    Thank you very much Siva!

    So I'm sending a workbook that I did just for here with examples of data

    So you can see that, for instance, on line 2, Mr X does not count for January statistics, because he left on the 1st of january. So nights and amount are all part of december

    But Mr Y arrived on the 29 of January and left on the 3rd of Feb. So he only had 2 nights in Feb.

    As you can see the statistics are being done by hand.

    Thanks in advance!
    Forum excel.png

  4. #4
    Forum Expert
    Join Date
    05-05-2015
    Location
    UK
    MS-Off Ver
    Microsoft Excel for Microsoft 365 MSO (Version 2402 Build 16.0.17328.20068) 64-bit
    Posts
    28,175

    Re: Excel formula for multiple data

    Attach a sample workbook (not image).

    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.

  5. #5
    Registered User
    Join Date
    01-04-2018
    Location
    Lagos
    MS-Off Ver
    2016
    Posts
    19

    Re: Excel formula for multiple data

    Thanks for the info.

    So I'm sending now the excel file.

    Thanks in advance
    Attached Files Attached Files

  6. #6
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Excel formula for multiple data

    Change b13:b15 as 1/12/2017,1/1/2018 & 1/2/2018 and use below array formula (confirm with Shift+Ctrl+Enter)
    c3=SUM(IF(($A$2:$A$4<=EOMONTH($B13,0))*($B$2:$B$4>=$B13),IF($B$2:$B$4>=EOMONTH($B13,0),EOMONTH($B13,0)+1,$B$2:$B$4)-IF($A$2:$A$4>=$B13,$A$2:$A$4,$B13),0))

    d3=SUM(IF(($A$2:$A$4<=EOMONTH($B13,0))*($B$2:$B$4>=$B13),IF($B$2:$B$4>=EOMONTH($B13,0),EOMONTH($B13,0)+1,$B$2:$B$4)-IF($A$2:$A$4>=$B13,$A$2:$A$4,$B13),0)*(F$2:F$4))
    see the attached file
    Attached Files Attached Files

  7. #7
    Registered User
    Join Date
    01-04-2018
    Location
    Lagos
    MS-Off Ver
    2016
    Posts
    19

    Re: Excel formula for multiple data

    Perfect, thanks!

    But for some reason if I touch the cell to see the formula it screws the values.. Is it because of the language?

  8. #8
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Excel formula for multiple data

    I think the formula is an array formula so that it happened. do the following
    Select the cell or stay in the cell
    press F2
    Press Shift+Ctrl+Enter at a time
    now you will get the result

  9. #9
    Registered User
    Join Date
    01-04-2018
    Location
    Lagos
    MS-Off Ver
    2016
    Posts
    19

    Re: Excel formula for multiple data

    Perfect,nflsales, that way works perfectly!

    It's just a smal thing, no big deal,but is it possible to bypass the formating of the months? I mean, Keep December, for instance instead of 01/12/2017?

  10. #10
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Excel formula for multiple data

    Right click the mouse
    formatcells > numbers > custom > enter or type
    MMMM
    under Type: > OK
    now 01/12/2017 will looks like December

  11. #11
    Registered User
    Join Date
    01-04-2018
    Location
    Lagos
    MS-Off Ver
    2016
    Posts
    19

    Re: Excel formula for multiple data

    Perfect! You're the best!

    Thank you very much!

  12. #12
    Registered User
    Join Date
    01-04-2018
    Location
    Lagos
    MS-Off Ver
    2016
    Posts
    19

    Re: Excel formula for multiple data

    Hi,

    Just used the formulas in the actual excel and I'm getting one problem. In october it's adding one more day. I have a person leaving on the 31st. Could it be that?

  13. #13
    Forum Guru samba_ravi's Avatar
    Join Date
    07-26-2011
    Location
    Hyderabad, India
    MS-Off Ver
    Excel 2021
    Posts
    8,914

    Re: Excel formula for multiple data

    =SUM(IF(($A$2:$A$4<=EOMONTH($B13,0))*($B$2:$B$4>=$B13),IF($B$2:$B$4>=EOMONTH($B13,0),EOMONTH($B13,0)+1,$B$2:$B$4)-IF($A$2:$A$4>=$B13,$A$2:$A$4,$B13),0))

    Remove the Highlighted "=" signed in your formula like
    =SUM(IF(($A$2:$A$4<=EOMONTH($B13,0))*($B$2:$B$4>=$B13),IF($B$2:$B$4>EOMONTH($B13,0),EOMONTH($B13,0)+1,$B$2:$B$4)-IF($A$2:$A$4>=$B13,$A$2:$A$4,$B13),0))

  14. #14
    Registered User
    Join Date
    01-04-2018
    Location
    Lagos
    MS-Off Ver
    2016
    Posts
    19

    Re: Excel formula for multiple data

    worked perfectly! Once again, thank you!

+ 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] Need Excel formula to use INDEX and MATCH with multiple criteria's over multiple ranges.?
    By mchilapur in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 03-22-2017, 08:56 AM
  2. Excel formula to match data on multiple worksheets
    By anjoseph9626 in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 04-16-2015, 09:04 AM
  3. Replies: 4
    Last Post: 07-19-2014, 04:04 PM
  4. Excel 2007 : Index, Match, Large Formula: Multiple Criteria, Multiple Ranges
    By SimpleJack in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 07-19-2013, 08:54 AM
  5. Replies: 2
    Last Post: 04-04-2013, 12:26 PM
  6. Inputting data from multiple instances from multiple users into a main Excel Workbook
    By smooth_beaker in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2013, 12:18 AM
  7. function/formula to copy/past multiple data rows in Excel worksheet
    By djerin in forum Excel Formulas & Functions
    Replies: 12
    Last Post: 05-22-2009, 09:16 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