+ Reply to Thread
Results 1 to 12 of 12

Using EOMONTH to stop a formula on the 1st Day of the next month.

  1. #1
    Registered User
    Join Date
    02-26-2016
    Location
    Cairns, Australia
    MS-Off Ver
    2010
    Posts
    15

    Using EOMONTH to stop a formula on the 1st Day of the next month.

    I am using a spreadsheet to calculate the number of bed nights our residents have in a month. I keep a running total if the guests are current (No Exit Date) but at the end of the month I need the tally to stop as it is a monthly report.

    =IF(Entry_Date="","",IF(Exit_Date="",DATEDIF(Entry_Date,TODAY(),"d"),Exit_Date-Entry_Date))

    This is what I have entered and it works perfectly until I get to the end of the month and there are residents current. I need the Bed Nights to stop calculating at the first day of the next month Is there a way to add in a EOMONTH part to this formula?

  2. #2
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    You don't really need the DATEDIF function.

    Replace it with:

    MIN(TODAY(),EOMONTH(Entry_Date,0))-Entry_Date
    Biff
    Microsoft MVP Excel
    Keep It Simple Stupid

    Let's Go Pens. We Want The Cup.

  3. #3
    Registered User
    Join Date
    02-26-2016
    Location
    Cairns, Australia
    MS-Off Ver
    2010
    Posts
    15

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    Thank You. This formula does not include the last night of the month as a bed night also. What would be the formula to include the last night?

  4. #4
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    Not sure I understand.

    Maybe this...

    =IF(Entry_Date="","",IF(Exit_Date="",MIN(TODAY(),EOMONTH(Entry_Date,0))-Entry_Date,MIN(Exit_Date,EOMONTH(Entry_Date,0))-Entry_Date))

  5. #5
    Registered User
    Join Date
    02-26-2016
    Location
    Cairns, Australia
    MS-Off Ver
    2010
    Posts
    15

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    Hmmm still does not give me the last night of the month included

  6. #6
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    Post a few examples and tell us what results you expect.

  7. #7
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    The formula in #4 plus 1:

    =IF(Entry_Date="","",IF(Exit_Date="",MIN(TODAY(),EOMONTH(Entry_Date,0))-Entry_Date+1,MIN(Exit_Date,EOMONTH(Entry_Date,0))-Entry_Date)+1)
    Quang PT

  8. #8
    Registered User
    Join Date
    02-26-2016
    Location
    Cairns, Australia
    MS-Off Ver
    2010
    Posts
    15

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    Thank you for your response. I need to now replace the Entry_Date with the first day of the month. What is the correct way to write this formula?

  9. #9
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    Quote Originally Posted by RYLEE.HART View Post
    Thank you for your response. I need to now replace the Entry_Date with the first day of the month. What is the correct way to write this formula?
    Replace Entry_Date with EOMONTH(TODAY(),-1)+1

  10. #10
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    Quote Originally Posted by RYLEE.HART View Post
    I need to now replace the Entry_Date with the first day of the month.
    Like this...

    Entry_Date-DAY(Entry_Date)+1

  11. #11
    Registered User
    Join Date
    02-26-2016
    Location
    Cairns, Australia
    MS-Off Ver
    2010
    Posts
    15

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    =IF(A6="","",IF(L6="",MIN(TODAY(),EOMONTH(A6,0))-A6+1,L6-DATE(2016,1,1)))

    A6 is entry_date, L6 is exit_date. I want my monthly register of guests to calculate the bed nights of each guest for the current month only. If the guest checked in on the previous month I do not want those bed nights of the previous month to be counted, only the current month. I need the bed nights to keep a running total (of only the current month) At the end of the month the bed nights stop adding up after counting the last night of the month.

    The formula above works except is it calculating the bed nights to the end of the entry_date month instead of the current month of the worksheet.. How do I rewrite this?

  12. #12
    Forum Expert Tony Valko's Avatar
    Join Date
    12-31-2011
    Location
    Pittsburgh
    MS-Off Ver
    2002, 2007:2013
    Posts
    18,890

    Re: Using EOMONTH to stop a formula on the 1st Day of the next month.

    Quote Originally Posted by RYLEE.HART View Post
    the current month of the worksheet..
    How is that defined? Is there a cell that holds that info?

+ 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] Stop date formula based on end on month
    By DawnAZ in forum Excel General
    Replies: 14
    Last Post: 02-26-2019, 07:32 AM
  2. =DATE(YEAR, MONTH, DAY) stop month increasing.
    By oneblondebrow in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-01-2016, 09:32 AM
  3. [SOLVED] Date functions YEAR, MONTH, EOMONTH do not work for the array format?
    By alice2011 in forum Excel General
    Replies: 2
    Last Post: 05-06-2015, 08:59 PM
  4. [SOLVED] EOMONTH formula calculation only work days
    By kettlecorn22 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 06-03-2014, 03:26 PM
  5. Replies: 6
    Last Post: 01-09-2011, 01:50 AM
  6. [SOLVED] RE: conditional formatting: problem entering EOMONTH formula...
    By Jonathan Cooper in forum Excel General
    Replies: 0
    Last Post: 02-06-2006, 05:40 PM
  7. [SOLVED] conditional formatting: problem entering EOMONTH formula...
    By MeatLightning in forum Excel General
    Replies: 0
    Last Post: 02-06-2006, 05:40 PM

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