Calculate number of days between 2 dates depending on column header

surkdidat

Active Member
Joined
Oct 1, 2011
Messages
370
Office Version
  1. 2016
Hi

Hope someone can help!

In Column A I have a start date
In Column B I have an end date (can be blank if product is "live") - (I can "end date this to 31/12/9999 if needed

In Columns C onwards I have the months from April 2020 onwards

What I need is a formula that looks at the start date in column A, the end date in column B, and then uses the months in Columns C onwards to calculate how many days that particular product has been live.

So if a product launched on 30 January 2021, it would count 2 days for January 2021 (30 & 31), and 28 days for February 2021.

Ideally, if its live can it calculate on todays date (so if it is 1 March 2021 when doing this, it would count 1 day, and then on Tuesday update it to 2.?

Thanks in advance!
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
56,468
Office Version
  1. 365
Platform
  1. Windows
How about
Excel Formula:
=DAYS(IF(B2="",TODAY(),B2),A2)+1
 

Dave Patton

Well-known Member
Joined
Feb 15, 2002
Messages
4,654
Office Version
  1. 365
  2. 2010
Platform
  1. Windows
Headings are dates like Jan 1 2021 Feb 1 2021

T202006a.xlsm
ABCDE
8StartEndJan-2021Feb-2021Mar-2021
930-Jan-2131-Dec-2122831
1026-Feb-2128-Feb-21030
11
9a
Cell Formulas
RangeFormula
C9:E10C9=MAX(0, MIN(EOMONTH(C$8, 0), $B9) + 1 - MAX(C$8, $A9))
B10B10=TODAY()
 
Solution

Watch MrExcel Video

Forum statistics

Threads
1,129,388
Messages
5,636,033
Members
416,892
Latest member
Bensch

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top