Calculate number of days between 2 dates depending on column header

surkdidat

Active Member
Joined
Oct 1, 2011
Messages
369
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!
 

Some videos you may like

Excel Facts

What is the fastest way to copy a formula?
If A2:A50000 contain data. Enter a formula in B2. Select B2. Double-click the Fill Handle and Excel will shoot the formula down to B50000.

Fluff

MrExcel MVP, Moderator
Joined
Jun 12, 2014
Messages
55,626
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,629
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,127,747
Messages
5,626,628
Members
416,195
Latest member
tonmcg

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