Calculate number of days between 2 dates depending on column header

surkdidat

Well-known Member
Joined
Oct 1, 2011
Messages
579
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

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
How about
Excel Formula:
=DAYS(IF(B2="",TODAY(),B2),A2)+1
 
Upvote 0
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()
 
Upvote 0
Solution

Forum statistics

Threads
1,213,497
Messages
6,114,002
Members
448,543
Latest member
MartinLarkin

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
Back
Top