excelの関数
今勤務表を作成しているのですが画像の中の基準労働日数の値を関数で作成していた所
条件としては閏年・31日がない月・休祭日出勤=C待機等々細かく条件を指定していましたら
以下のように長くなってしまいましたもう少し短くしたいのですが
マクロ等組んだことがなくどうすればいいのか分かるかた教えてください
=IF(TEXT(J4,"mm")="02",
IF(TEXT(B36,"mm")=TEXT(J4,"mm"),
IF(C8=1,
NETWORKDAYS(J4,B36)
-COUNTIFS(Y8:Y36,"*日")
-COUNTIFS(C8:C36,">=2",C8:C36,"<=6",Y8:Y36,"*C待機*")
-COUNTIFS(C8:C36,">=2",C8:C36,"<=6",Y8:Y36,"*年末年始*"),
IF(C8=7,
NETWORKDAYS(J4,B36)
-COUNTIFS(Y8:Y36,"*日")
-COUNTIFS(C8:C36,">=2",C8:C36,"<=6",Y8:Y36,"*C待機*")
-COUNTIFS(C8:C36,">=2",C8:C36,"<=6",Y8:Y36,"*年末年始*"),
NETWORKDAYS(J4,B36)
-COUNTIFS(Y8:Y36,"*日")
-COUNTIFS(C8:C36,">=2",C8:C36,"<=6",Y8:Y36,"*C待機*")
-COUNTIFS(C8:C36,">=2",C8:C36,"<=6",Y8:Y36,"*年末年始*")
)
),
IF(C8=1,
NETWORKDAYS(J4,B35)
-COUNTIFS(Y8:Y35,"*日")
-COUNTIFS(C8:C35,">=2",C8:C35,"<=6",Y8:Y35,"*C待機*")
-COUNTIFS(C8:C35,">=2",C8:C35,"<=6",Y8:Y35,"*年末年始*"),
IF(C8=7,
NETWORKDAYS(J4,B36)
-COUNTIFS(Y8:Y35,"*日")
-COUNTIFS(C8:C35,">=2",C8:C35,"<=6",Y8:Y35,"*C待機*")
-COUNTIFS(C8:C35,">=2",C8:C35,"<=6",Y8:Y35,"*年末年始*"),
NETWORKDAYS(J4,B36)
-COUNTIFS(Y8:Y35,"*日")
-COUNTIFS(C8:C35,">=2",C8:C35,"<=6",Y8:Y35,"*C待機*")
-COUNTIFS(C8:C35,">=2",C8:C35,"<=6",Y8:Y35,"*年末年始*")
)
)
),IF(TEXT(B38,"mm")=TEXT(J4,"mm"),
IF(C8=1,
NETWORKDAYS(J4,B38)
-COUNTIFS(Y8:Y38,"*日")
-COUNTIFS(C8:C38,">=2",C8:C38,"<=6",Y8:Y38,"*C待機*")
-COUNTIFS(C8:C38,">=2",C8:C38,"<=6",Y8:Y38,"*年末年始*"),
IF(C8=7,
NETWORKDAYS(J4,B38)
-COUNTIFS(Y8:Y38,"*日")
-COUNTIFS(C8:C38,">=2",C8:C38,"<=6",Y8:Y38,"*C待機*")
-COUNTIFS(C8:C38,">=2",C8:C38,"<=6",Y8:Y38,"*年末年始*"),
NETWORKDAYS(J4,B38)
-COUNTIFS(Y8:Y38,"*日")
-COUNTIFS(C8:C38,">=2",C8:C38,"<=6",Y8:Y38,"*C待機*")
-COUNTIFS(C8:C38,">=2",C8:C38,"<=6",Y8:Y38,"*年末年始*")
)
),
IF(C8=1,
NETWORKDAYS(J4,B37)
-COUNTIFS(Y8:Y37,"*日")
-COUNTIFS(C8:C37,">=2",C8:C37,"<=6",Y8:Y37,"*C待機*")
-COUNTIFS(C8:C37,">=2",C8:C37,"<=6",Y8:Y37,"*年末年始*"),
IF(C8=7,
NETWORKDAYS(J4,B37)
-COUNTIFS(Y8:Y37,"*日")
-COUNTIFS(C8:C37,">=2",C8:C37,"<=6",Y8:Y37,"*C待機*")
-COUNTIFS(C8:C37,">=2",C8:C37,"<=6",Y8:Y37,"*年末年始*"),
NETWORKDAYS(J4,B37)
-COUNTIFS(Y8:Y37,"*日")
-COUNTIFS(C8:C37,">=2",C8:C37,"<=6",Y8:Y37,"*C待機*")
-COUNTIFS(C8:C37,">=2",C8:C37,"<=6",Y8:Y37,"*年末年始*")
)
)
)
)
お礼
素早い対応ありがとうございました。 随分複雑な式なのですね、ちょっとネットで調べたぐらいでは到底でない訳ですね。 大変助かります。本当にありがとうございました。