+ Reply to Thread
Results 1 to 11 of 11

Count days in specific range based on criteria

  1. #1
    Registered User
    Join Date
    01-23-2013
    Location
    phoenix, arizona
    MS-Off Ver
    Excel 2012
    Posts
    71

    Count days in specific range based on criteria

    In the attached document, I'm trying to count the number of days a particular property is vacant. I have move-in and move-out dates for numerous properties (a single property may have had numerous tenants), and I'd like to know the total number of days from June-September (for each month) that ALL of those properties were not occupied.

    For instance, if I were to look at property 156 ONLY, I would count a total of 22 days in May unoccupied.

    Thanks!
    Attached Files Attached Files

  2. #2
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Count days in specific range based on criteria

    Hi -

    Attached is your file with the following formula added:

    =MAX(IF(VLOOKUP($K$2,$A$2:$E$1178,5,0)=0,VLOOKUP($K$2,$A$2:$E$1178,4,0)-H4,I4-VLOOKUP($K$2,$A$2:$E$1178,5,0)),0)

    I used Cell K2 to enter whatever property number you want and the formula finds that property and determines the days vacant in cells C4:K8 by each month. First, the formula looks to see if there is a move out date. If not, then it compares the move in date to the beginning of the month (Column H). If there is a move out date, it compares that date to the end of the month (Column I). The MAX function gets rid of any negative numbers than arise when there is no Move Out date and we are looking into future months.

    Attached is your Spreadsheet with the above formula in place.

    Hope this helps.
    Attached Files Attached Files
    ____________________________________________
    If this has solved your problem, please edit the thread title to add the word [SOLVED] at the beginning. You can do this by
    -Go to the top of the first post
    -Select Thread Tools
    -Select Mark thread as Solved

    If I have been particularly helpful, please "bump" my reputation by pressing the small star in the lower left corner of my post.

  3. #3
    Registered User
    Join Date
    06-20-2013
    Location
    Scottsdale, Arizona
    MS-Off Ver
    Excel 2010
    Posts
    31

    Re: Count days in specific range based on criteria

    Good Job Loginjmor

  4. #4
    Registered User
    Join Date
    01-23-2013
    Location
    phoenix, arizona
    MS-Off Ver
    Excel 2012
    Posts
    71

    Re: Count days in specific range based on criteria

    Thank you loginjmor!

    It's close, but doesn't quite get there. I moved a few things around in the spreadsheet you gave me, attached. I'm looking for the total per month (which is easy enough once I have the total for each property), so I applied your formula to all properties and the 4 months I'm looking for. Some are accurate, but many numbers are all over the place. I highlighted property 6352 on row 76 for an example. That in addition to the numerous results that range in the 3 digits.

    In leiu of VBA, is there a formula-based solution for this issue?

    Thanks again
    Attached Files Attached Files

  5. #5
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Count days in specific range based on criteria

    Hi -

    I see the problem. You don't want the total cumulative days the unit has been empty. You just want the days of that month that it's been empty. Try this:

    =MAX(IF(VLOOKUP(G4,A:E,5,0)=0,MIN(VLOOKUP(G4,A:E,4,0)-H4,I4-H4+1),MIN(I4-VLOOKUP(G4,A:E,5,0),I4-H4+1)),0)

    Paste into K4 and copy down. Let me know if you have any other issues.

  6. #6
    Registered User
    Join Date
    01-23-2013
    Location
    phoenix, arizona
    MS-Off Ver
    Excel 2012
    Posts
    71

    Re: Count days in specific range based on criteria

    Almost!

    It appears to be ignoring move-outs on properties with more than one resident. Even when assigning a move-out date of 12/31/2016 it results in "Days vacant" of the whole month.

    Capture.JPG
    Attached Images Attached Images

  7. #7
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Count days in specific range based on criteria



    The upload is showing move-outs way into the future ... including Evictions??
    Dave

  8. #8
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Count days in specific range based on criteria

    I'm not certain that I am interpreting this correctly.

    With the 1st of the month dates as helpers in F1:I1 this helper formula entered in $F$2:$I$1178.
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Then this summary formula in M4:M7
    Formula: copy to clipboard
    Please Login or Register  to view this content.




    J
    K
    L
    M
    3
    Days vacant
    4
    6/1/2016
    6/30/2016
    June
    88
    5
    7/1/2016
    7/31/2016
    July
    97
    6
    8/1/2016
    8/31/2016
    August
    81
    7
    9/1/2016
    9/30/2016
    September
    52

  9. #9
    Valued Forum Contributor loginjmor's Avatar
    Join Date
    01-31-2013
    Location
    Cedar Rapids, Iowa
    MS-Off Ver
    Excel 2013
    Posts
    1,073

    Re: Count days in specific range based on criteria

    Hi -

    OK I can fix that. But on the properties that have multiple entries/tenants, is there ever a time where you have a gap between those tenants or are they both living there so the building is considered occupied from the time the first tenant moves in until the last tenant move out?

    Example:

    Tenant 1 move in 6/1/16 moves out 7/15/16
    Tenant 2 move in 7/31/16 move out 8/31/16

    Is the above considered occupied from 6/1/16 through 8/31/16? Or do you consider there to be a 16 day gap from 7/15 to 7/31?

  10. #10
    Registered User
    Join Date
    01-23-2013
    Location
    phoenix, arizona
    MS-Off Ver
    Excel 2012
    Posts
    71

    Re: Count days in specific range based on criteria

    Hi login...that's exactly what I'm looking for, the specific number of days a property is vacant between tenants. In your example, I do consider there to be a gap between 7/15 and 7/31, although technically I would count 15 vacant days (when working on a similar issue, I found https://exceljet.net/formula/calcula...verlap-in-days, where it analogizes days between dates to fence posts). That is, we count the move-out date as still occupied.

    Flameretired I'll look at yours in just a minute, that appears to be what I'm looking for.

    With all the work you guys are putting into this (which I'm tremendously grateful for!), I almost feel I should have saved you all the trouble and just gone with VBA. But thank you all.
    Last edited by mgblair; 10-06-2016 at 03:56 PM.

  11. #11
    Registered User
    Join Date
    01-23-2013
    Location
    phoenix, arizona
    MS-Off Ver
    Excel 2012
    Posts
    71

    Re: Count days in specific range based on criteria

    The forums were down for me for a couple of days after the last post so I guess this kind of died. In the meantime, I figured out a solution for this, attached, hopefully it helps somebody!
    Attached Files Attached Files

+ 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] Count based on specific quantity & criteria
    By cuznleroy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 09-26-2016, 08:28 PM
  2. Count cells in a range that match a specific criteria in a different cell range
    By RhapsodyBay in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-13-2015, 02:10 PM
  3. [SOLVED] Sum Specific range of days into Months based upon Category
    By usc1382 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-29-2012, 11:53 PM
  4. Count days between dates based on criteria
    By efernandes67 in forum Excel General
    Replies: 9
    Last Post: 06-23-2012, 04:29 PM
  5. count specific days within date range
    By Sazza in forum Excel General
    Replies: 3
    Last Post: 03-27-2012, 09:04 AM
  6. Completed and remaining days count based on the dates range
    By krjoshi in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-21-2011, 01:59 PM
  7. Remaining days count based on the dates range
    By krjoshi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-21-2011, 11:47 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