+ Reply to Thread
Results 1 to 6 of 6

Formula to calculate days in month Item is Held

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    12-20-2017
    Location
    California
    MS-Off Ver
    Office 365
    Posts
    104

    Formula to calculate days in month Item is Held

    Hi,

    In the attached file, in the area highlighted in yellow, I need help trying to figure out how to populate in each month, how many days a item will be held until sold. There is a purchase date and a sale date referenced. This will calculate how many days the item is held.

    I'm trying to figure out how many days it will be held in month 1, month 2, month 3 etc. I've filled in the cells manually for purposes of example.

    Thanks in advance.

    -Manny
    Attached Files Attached Files

  2. #2
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2024
    Posts
    6,175

    Re: Formula to calculate days in month Item is Held

    Try this in F5:

    =SUMPRODUCT(--(TEXT(ROW(INDIRECT($C5&":"&$D5)),"mmm")=LEFT(F$3,3)))

  3. #3
    Forum Contributor
    Join Date
    12-20-2017
    Location
    California
    MS-Off Ver
    Office 365
    Posts
    104

    Re: Formula to calculate days in month Item is Held

    Worked Perfectly. Thanks for the help!

    -Manny

  4. #4
    Forum Guru
    Join Date
    04-23-2012
    Location
    New Jersey, USA
    MS-Off Ver
    Excel 365
    Posts
    2,463

    Re: Formula to calculate days in month Item is Held

    Quote Originally Posted by Phuocam View Post
    Try this in F5:

    =SUMPRODUCT(--(TEXT(ROW(INDIRECT($C5&":"&$D5)),"mmm")=LEFT(F$3,3)))
    The above formula is Volatile... we can rewrite it as below to make it non-Volatile.

    =SUMPRODUCT(--(TEXT(ROW(INDEX(A:A,$C5):INDEX(A:A,$D5)),"mmm")=LEFT(F$3,3)))

  5. #5
    Forum Guru
    Join Date
    08-05-2004
    Location
    NJ
    MS-Off Ver
    365
    Posts
    13,582

    Re: Formula to calculate days in month Item is Held

    Much simpler than my solution of
    Formula: copy to clipboard
    =IF(OR($D5<F$4, EOMONTH(F$4,0)<$C5),0, MIN(MAX(EOMONTH(F$4,0),$C5),$D5)-MAX($C5,F$4)+1)

    Where row 4 was the date, first of each month.
    Attached Files Attached Files
    ChemistB
    My 2?

    substitute commas with semi-colons if your region settings requires
    Don't forget to mark threads as "Solved" (Edit First post>Advanced>Change Prefix)
    If I helped, Don't forget to add to my reputation (click on the little star at bottom of this post)

    Forum Rules: How to use code tags, mark a thread solved, and keep yourself out of trouble

  6. #6
    Forum Guru Bo_Ry's Avatar
    Join Date
    09-10-2018
    Location
    Thailand
    MS-Off Ver
    MS 365
    Posts
    7,222

    Re: Formula to calculate days in month Item is Held

    Another one
    F5
    =MAX(0,MIN(EDATE(F$3&2020,1),$D5+1)-MAX(--(F$3&2020),$C5))

+ 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 formula to calculate days used in month initiated in previous and selected month
    By Ochimus in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-14-2021, 05:54 AM
  2. [SOLVED] Formula to calculate how many days in a month have Daylight Savings
    By kersplash in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 12-21-2018, 03:39 AM
  3. [SOLVED] Formula to calculate working days and calendar days per month-year ?
    By donny007 in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 11-05-2018, 06:23 PM
  4. [SOLVED] Need formula to calculate days in each month across multiple Start and End dates
    By Ochimus in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-25-2017, 04:19 PM
  5. [SOLVED] Formula needed to calculate working days in specified month between two dates
    By webfeet2 in forum Excel Formulas & Functions
    Replies: 8
    Last Post: 10-24-2013, 02:19 AM
  6. Replies: 1
    Last Post: 12-09-2012, 06:01 PM
  7. formula to calculate numbers of days (i.e. Monday's) in a month
    By Carol in forum Excel - New Users/Basics
    Replies: 3
    Last Post: 07-06-2007, 07:31 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