Retroshift
Board Regular
- Joined
- Sep 20, 2016
- Messages
- 119
- Office Version
- 2019
- Platform
- Windows
Hi,
I am looking for an Excel non-VBA function formula based on two parameters.
If a cell holds the value 10, then a date starting from 24 December is added, but only if this date is a workday.
If this date is not a workday, then it takes the first day before this date that is a workday.
If the cell holds the value 9, then two dates retrochronologically starting from 24 December downward are added, under the same condition that they should be workdays.
If the cell holds the value 8, then three dates retrochronologically starting from 24 December downward are added, under the same condition that they should be workdays.
I started a formula (=IF(AND(E4=10,C5=1),A5,IF(C4=1,A4,""))) but it does not seem to capture the inherently intertwining logic of all the parameters.
I am looking for an Excel non-VBA function formula based on two parameters.
If a cell holds the value 10, then a date starting from 24 December is added, but only if this date is a workday.
If this date is not a workday, then it takes the first day before this date that is a workday.
If the cell holds the value 9, then two dates retrochronologically starting from 24 December downward are added, under the same condition that they should be workdays.
If the cell holds the value 8, then three dates retrochronologically starting from 24 December downward are added, under the same condition that they should be workdays.
I started a formula (=IF(AND(E4=10,C5=1),A5,IF(C4=1,A4,""))) but it does not seem to capture the inherently intertwining logic of all the parameters.
codeblad excel met macro's.xlsm | ||||||||
---|---|---|---|---|---|---|---|---|
A | B | C | D | E | F | |||
1 | Date(s) to be added | Eligible extra days | Workday = 1 (parameter) | |||||
2 | 21/12/2022 | 1 | ||||||
3 | 22/12/2022 | 1 | Parameter | |||||
4 | 23/12/2022 | 1 | 10 | |||||
5 | 24/12/2022 | 23/12/2022 | 0 | |||||
6 | The cell above can be 10 or 9 or 8 | |||||||
7 | ||||||||
Blad1 |
Cell Formulas | ||
---|---|---|
Range | Formula | |
A2 | A2 | =DATE(YEAR(TODAY()),12,21) |
A3 | A3 | =DATE(YEAR(TODAY()),12,22) |
A4 | A4 | =DATE(YEAR(TODAY()),12,23) |
C2:C5 | C2 | =IF(WORKDAY(A2-1,1)=A2,1,0) |
A5 | A5 | =DATE(YEAR(TODAY()),12,24) |
B5 | B5 | =IF(AND(E4=10,C5=1),A5,IF(C4=1,A4,"")) |