dimanche 19 avril 2020

Excel: I have two working formulas. Need to get them to run based on =IF(WEEKDAY)

Im building a schedule rotation in which a group of employees are either Primary oncall, Secondary oncall, or not OnCall at all.

I have a row in my spreadsheet that validates if both primary and secondary are covered on any given day, however secondaries are not used on weekends. (P=primary, WP=Weekend Primary, HP=Holiday Primary, same with secondaries for tracking purposes)

In the examples below row 3 houses the dates, beginning in column B as the first of the month, B3=5/1/2020 (which is a Friday), C3=5/2/2020 (Saturday), etc

This works for Monday through Friday: =IF(AND(SUM(COUNTIF(B5:B11,"p")+(COUNTIF(B5:B11,"wp"))+(COUNTIF(B5:B11,"Hp")))=1)*(SUM(COUNTIF(B5:B11,"s")+(COUNTIF(B5:B11,"ws"))+(COUNTIF(B5:B11,"Hs")))=1),"G","B")

This works for Weekends: =IF(AND(SUM(COUNTIF(C5:C11,"p")+(COUNTIF(C5:C11,"wp"))+(COUNTIF(C5:C11,"Hp")))=1),"G","B")

The problem is every month when I go to do the next schedule, i have to rearrange the the formulas in this row so they pine up below weekdays or weekends, respectively. Id like to combine these formulas into an =IF(Weekend,,2)<6,weekday formula, else weekend formula

My Attempt =IF((WEEKDAY,B$3,2)<6,IF(AND(SUM(COUNTIF(B5:B11,"p")+(COUNTIF(B5:B11,"wp"))+(COUNTIF(B5:B11,"Hp")))=1)*(SUM(COUNTIF(B5:B11,"s")+(COUNTIF(B5:B11,"ws"))+(COUNTIF(B5:B11,"Hs")))=1),"G","B"),IF(AND(SUM(COUNTIF(B5:B11,"p")+(COUNTIF(B5:B11,"wp"))+(COUNTIF(B5:B11,"Hp")))=1),"G","B"))

Aucun commentaire:

Enregistrer un commentaire