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,"*年末年始*")
)
)
)
)
補足
ご回答ありがとうございます。 やってみて、うまく動かない点 =SUMIF(A1:A65000,AB2,AA1:AA65000)の A1:A65000はどこを参照しているのでしょうか?