Search code examples
excelif-statementformula

EXCEL formula if condition


Is there a way to simplify the below formula in the picture, and how do you include a condition to also move the "actual payment date" to next day if it fall on any Holiday dates?

=F106+IF($C$100="Next",IF(TEXT(G106,"DDD")="Sat",2,IF(TEXT(G106,"ddd")="Sun",1,0)),IF($C$100="Previous",IF(TEXT(G106,"ddd")="Sat",-1,IF(TEXT(G106,"ddd")="Sun",-2,0)))) 

Picture


Solution

  • We can use WORKDAY to return the next or previous workday and it includes a criterion that accepts a range of dates for holidays:

    =IF($C$100="Next",WORKDAY(F106-1,1,$L$106:$L$110),WORKDAY(F106+1,-1,$L$106:$L$110))
    

    Where $L$106:$L$110 is the range with your holiday dates.