Retroshift

Board Regular
Joined
Sep 20, 2016
Messages
119
Office Version
  1. 2019
Platform
  1. 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.

codeblad excel met macro's.xlsm
ABCDEF
1Date(s) to be addedEligible extra daysWorkday = 1 (parameter)
221/12/20221
322/12/20221Parameter
423/12/2022110
524/12/202223/12/20220
6The cell above can be 10 or 9 or 8
7
Blad1
Cell Formulas
RangeFormula
A2A2=DATE(YEAR(TODAY()),12,21)
A3A3=DATE(YEAR(TODAY()),12,22)
A4A4=DATE(YEAR(TODAY()),12,23)
C2:C5C2=IF(WORKDAY(A2-1,1)=A2,1,0)
A5A5=DATE(YEAR(TODAY()),12,24)
B5B5=IF(AND(E4=10,C5=1),A5,IF(C4=1,A4,""))
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Excel double condition formula
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem.
 
Upvote 0
So far, I have this formula but it does not take into account that 2 dates should be added if parameter B is 9 and 3 dates if parameter B is 8 (under the condition that it should be workdays in column B).
Any help with completing this formula would be greatly appreciated.

Excel Formula:
=IF(AND(E4=10,INDEX(A2:A5,MATCH(1,B2:B5,0))),INDEX(A2:A5,MATCH(1,B2:B5,0)),IF(AND(E4=9,INDEX(A2:A5,MATCH(1,B2:B5,0))),INDEX(A2:A5,MATCH(1,B2:B5,0)),IF(AND(E4=8,INDEX(A2:A5,MATCH(1,B2:B5,0))),INDEX(A2:A5,MATCH(1,B2:B5,0)),"")))

codeblad excel met macro's.xlsm
ABCDEF
1Date(s) to be addedWorkday = 1 (parameter A)Eligible extra days
224/12/2022023/12/2022
323/12/20221parameter B
422/12/2022110
521/12/20221
6The cell above can be 8, 9 or 10.
7
Blad1
Cell Formulas
RangeFormula
A2A2=DATE(YEAR(TODAY()),12,24)
B2:B5B2=IF(WORKDAY(A2-1,1)=A2,1,0)
C2C2=IF(AND(E4=10,INDEX(A2:A5,MATCH(1,B2:B5,0))),INDEX(A2:A5,MATCH(1,B2:B5,0)),IF(AND(E4=9,INDEX(A2:A5,MATCH(1,B2:B5,0))),INDEX(A2:A5,MATCH(1,B2:B5,0)),IF(AND(E4=8,INDEX(A2:A5,MATCH(1,B2:B5,0))),INDEX(A2:A5,MATCH(1,B2:B5,0)),"")))
A3A3=DATE(YEAR(TODAY()),12,23)
A4A4=DATE(YEAR(TODAY()),12,22)
A5A5=DATE(YEAR(TODAY()),12,21)
 
Upvote 0

Forum statistics

Threads
1,224,815
Messages
6,181,136
Members
453,021
Latest member
Justyna P

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