Formula help required - 4 date columns

RI_1978

New Member
Joined
Jun 4, 2020
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
Require formula help. There are columns heading with monthly dates e.g Jan 20, Feb 2020 and so forth up to 2021. Value of 1 will be entered depending on dates.

Rows have details on resources together with 4 date columns for each resource. Example for Resource A
START DATE = 31/01/2020
END DATE = 31/12/2021
LEAVING DATE = 31/05/2020
NEW JOINER DATE = 31/08/2020

Criteria as follows required for formula

- Value of 1 will be entered in the monthly columns if START DATE = 01/01/2020 and END DATE = 31/12/2021 for resource A. Reflects resource working.
- If LEAVING DATE = 31/05/2020 and new JOINER DATE = 31/08/2020 then value of 0 should be entered from May 2020 up to Jul 2020. Aug 20 should have 1 as it reflects resource re-starting again.

Is there a formula in excel can execute the above or is VBA required?
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Try this and amend to suit your needs

Results
Dates.jpg



Date in G2, H2 etc is the LAST day of the month (which is calculated by formula in the example)
In the picture above those cells are custom formatted "mmm-yy"
That date is the used in the formula in row 3
=IF(AND(G$2>=$D3,G$2<$E3),0,IF(AND(G$2>=$B3,G$2<=$C3),1,0))


Book1
ABCDEFGHIJKLMNO
131/01/2020
2ResourceStartEndLeavingNew Join31/01/202029/02/202031/03/202030/04/202031/05/202030/06/202031/07/202031/08/202030/09/2020
3R131/01/202031/12/202131/05/202031/08/2020111100011
Sheet4
Cell Formulas
RangeFormula
G2:O2G2=EDATE($G$1,COLUMN(G1)-COLUMN($G$1))
G3:O3G3=IF(AND(G$2>=$D3,G$2<$E3),0,IF(AND(G$2>=$B3,G$2<=$C3),1,0))
 
Upvote 0

Forum statistics

Threads
1,214,991
Messages
6,122,628
Members
449,095
Latest member
bsb1122

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