メインコンテンツへスキップ

Excelで週末または休日を除くXNUMXつの日付間の正味労働時間を計算するにはどうすればよいですか?

多くの企業では、スタッフは労働時間によって支払われます。 XNUMX日の正味労働時間を計算するのは簡単ですが、日付範囲の正味時間を計算するのはどうですか? そのために、この記事では、Excelで週末と休日を除くXNUMXつの日付の間の正味労働時間を計算する式を紹介します。

週末を除く就業日を計算する

週末/休日を除く労働時間を計算する


矢印青い右バブル 週末を除く就業日を計算する

このパートでは、週末を除くXNUMXつの日時の間の就業日を計算する式を紹介します。

1.開始日時と終了日時を入力するXNUMXつのセルを選択し、右クリックして選択します セルの書式設定 コンテキストメニューを形成します。 スクリーンショットを参照してください:
docネットワーク時間1

2。 の中に セルの書式設定 ダイアログ、クリック タブ、および選択 カスタム 形成する カテゴリー リストし、入力します m / d / yyyy h:mm 右側のテキストボックス。 スクリーンショットを参照してください:
docネットワーク時間2

3。 クリック OK。 そして、開始日時と終了日時をXNUMXつのセルに別々に入力します。 スクリーンショットを参照してください:
docネットワーク時間3

4.これら13つのセルの隣のセル、たとえばCXNUMXに、この数式を入力します =NETWORKDAYS(A13,B13)-1-MOD(A13,1)+MOD(B13,1)、プレス 入力します キーを押すと、カスタム形式で結果が表示され、結果セルを選択して、 ホーム タブをクリックし、 数の書式 リストを選択して[一般]を選択し、正しい形式としてフォーマットします。 スクリーンショットを参照してください:
docネットワーク時間4


矢印青い右バブル 週末/休日を除く労働時間を計算する

週末または休日を除く正味労働時間を計算する場合は、次のように実行できます。

週末を除く正味労働時間を計算する

1. XNUMXつのセルを選択し、カスタム形式m / d / yyyy h:mmとしてフォーマットし、開始日時と終了日時を入力します。 スクリーンショットを参照してください:
docネットワーク時間5

docネットワーク時間6

2.セルの横、たとえばC2に、次の数式を入力します。
=(NETWORKDAYS(A2,B2)-1)*("17:30"-"8:30")+IF(NETWORKDAYS(B2,B2),MEDIAN(MOD(B2,1),"17:30","8:30"),"17:30")-MEDIAN(NETWORKDAYS(A2,A2)*MOD(A2,1),"17:30","8:30"),
入力します キーを押すと、数字の文字列が表示されます。 スクリーンショットを参照してください:
docネットワーク時間7

3.数字列を右クリックして、 セルの書式設定 コンテキストメニューから、および セルの書式設定 ダイアログ、選択 カスタム フォーム カテゴリー 下のリスト Numberタブをクリックし、これを入力します [うーん タイプテキストボックスに。 スクリーンショットを参照してください:
docネットワーク時間8

4。 クリック OK。 これで、週末を除くXNUMXつの日付間の正味労働時間がカウントされます。
docネットワーク時間9

先端:式では、A2は開始日時、B2は終了日時、8:30と17:30は毎日の一般的な開始時刻と終了時刻であり、必要に応じて変更できます。

週末と休日を除く正味労働時間を計算する

1.上記と同じように、XNUMXつのセルを選択し、カスタムフォーマットとしてフォーマットします m / d / yyyy h:mm、開始日時と終了日時を入力します。
docネットワーク時間10

2.空白のセルを選択し、休日の日付を入力します。ここでは3つの休日があり、H1:H3に個別に入力します。 スクリーンショットを参照してください:
docネットワーク時間11

3.カウントされた結果(たとえばC2)を配置する空白のセルを選択します。
=(NETWORKDAYS.INTL(A2,B2,11,H$1:H$3)-1)*("17:30"-"8:30")+IF(NETWORKDAYS.INTL(B2,B2,11,H$1:H$3),MEDIAN(MOD(B2,1),"8:30","17:30"),"17:30")-MEDIAN(NETWORKDAYS.INTL(A2,A2,11,H$1:H$3)*MOD(A2,1),"8:30","17:30"),
を押し 入力します キーを押すと、数値文字列が取得され、カスタム形式としてフォーマットされます [うーん。 スクリーンショットを参照してください:
docネットワーク時間12

先端:数式では、A2は開始日時、B2は終了日時、8:30と17:30は毎日の一般的な開始時刻と終了時刻、H1:H3は休日のセルであり、変更できます。必要に応じて。

Excelで日時に日/年/月/時/分/秒を簡単に追加

セルに日時形式のデータがあり、この日付に日、年、月、時間、分、または秒の数を追加する必要があるとします。 通常、数式を使用することはすべてのExcelユーザーにとって最初の方法ですが、すべての数式を覚えるのは困難です。 と Kutools for Excelさん 日付と時刻のヘルパー ユーティリティを使用すると、日付時刻に日、年、月、または時間、分、秒を簡単に追加できます。さらに、数式をまったく覚えていなくても、特定の誕生日に基づいて日付の差や年齢を計算できます。 クリックすると、30 日間の全機能を無料で試用できます。
doc追加時間分秒
 
Kutools for Excel:300を超える便利なExcelアドインがあり、30日以内に制限なしで無料で試すことができます。

最高のオフィス生産性向上ツール

🤖 Kutools AI アシスタント: 以下に基づいてデータ分析に革命をもたらします。 インテリジェントな実行   |  コードを生成  |  カスタム数式の作成  |  データを分析してグラフを生成する  |  Kutools関数を呼び出す...
人気の機能: 重複を検索、強調表示、または識別する   |  空白行を削除する   |  データを失わずに列またはセルを結合する   |   数式なしのラウンド ...
スーパールックアップ: 複数の基準の VLookup    複数の値の VLookup  |   複数のシートにわたる VLookup   |   ファジールックアップ ....
詳細ドロップダウン リスト: ドロップダウンリストを素早く作成する   |  依存関係のドロップダウン リスト   |  複数選択のドロップダウンリスト ....
列マネージャー: 特定の数の列を追加する  |  列の移動  |  Toggle 非表示列の表示ステータス  |  範囲と列の比較 ...
注目の機能: グリッドフォーカス   |  デザインビュー   |   ビッグフォーミュラバー    ワークブックとシートマネージャー   |  リソースライブラリ (自動テキスト)   |  日付ピッカー   |  ワークシートを組み合わせる   |  セルの暗号化/復号化    リストごとにメールを送信する   |  スーパーフィルター   |   特殊フィルター (太字/斜体/取り消し線をフィルター...) ...
上位 15 のツールセット12 テキスト ツール (テキストを追加, 文字を削除する、...)   |   50+ チャート 種類 (ガントチャート、...)   |   40+ 実用的 (誕生日に基づいて年齢を計算する、...)   |   19 挿入 ツール (QRコードを挿入, パスから画像を挿入、...)   |   12 変換 ツール (数字から言葉へ, 通貨の換算、...)   |   7 マージ&スプリット ツール (高度な結合行, 分割セル、...)   |   ... もっと

Kutools for Excel で Excel スキルを強化し、これまでにない効率を体験してください。 Kutools for Excelは、生産性を向上させ、時間を節約するための300以上の高度な機能を提供します。  最も必要な機能を入手するにはここをクリックしてください...

説明


Officeタブは、タブ付きのインターフェイスをOfficeにもたらし、作​​業をはるかに簡単にします

  • Word、Excel、PowerPointでタブ付きの編集と読み取りを有効にする、パブリッシャー、アクセス、Visioおよびプロジェクト。
  • 新しいウィンドウではなく、同じウィンドウの新しいタブで複数のドキュメントを開いて作成します。
  • 生産性を 50% 向上させ、毎日何百回もマウス クリックを減らすことができます!
Comments (67)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
This formula is very good. Does anyone know how I can convert this to SQL query?
This comment was minimized by the moderator on the site
it works
how to add lunch break?
This comment was minimized by the moderator on the site
This is very good, what if the shift time spans over 2 days (start time 17:00 to 02:00 next day)
This comment was minimized by the moderator on the site
Hi
Have recieved any update regarding for your questions because I am also finding for same
This comment was minimized by the moderator on the site
Can anyone help me how the formula would be if the work hours are from 8:00 pm to 5:00 am (20:00 to 5:00)?
This comment was minimized by the moderator on the site
Tried the same formula but it's showing negative values.
This comment was minimized by the moderator on the site
Anyone need this formula but for graveyard or night shift schedule?
This comment was minimized by the moderator on the site
Why is the Median function used in this formula? what is calculating
This comment was minimized by the moderator on the site
Hey, thanks for this formula.

But can we apply this formula for same dates.

For ex,
if start date and time is
" 15/11/20 11:10AM" and end date and time is "15 /11/20 11:25AM"
This comment was minimized by the moderator on the site
Hi, Pooja, use formula (M1 is the start time,M2 is the end time)
=(NETWORKDAYS(M1,M2)-1)*("17:30"-"8:30")+IF(NETWORKDAYS(M2,M2),MEDIAN(MOD(M2,1),"17:30","8:30"),"17:30")-MEDIAN(NETWORKDAYS(M1,M1)*MOD(M1,1),"17:30","8:30")
and format the result cell as time.
This comment was minimized by the moderator on the site
Hi, Sunny, thank you so much, this works perfectly now.
This comment was minimized by the moderator on the site
Hi the formula below works well with me to calculate the tame a task is taking from start to finish excluding a standard weekends of Saturday and Sunday off.
=(NETWORKDAYS(I7,J7)-1)*("18:00"-"8:30")+IF(NETWORKDAYS(J7,J7),MEDIAN(MOD(J7,1),"18:00","8:30"),"18:00")-MEDIAN(NETWORKDAYS(I7,I7)*MOD(I7,1),"18:00","8:30")

However, on Friday we would like to consider 3 working hours only (9:00-12:00), how can I insert it within the formula please? any idea?
This comment was minimized by the moderator on the site
Hi, Pierre, I have modified the formula:
=((NETWORKDAYS(A1,B1)-1)*("18:00"-"8:30")+IF(NETWORKDAYS(B1,B1),MEDIAN(MOD(B1,1),"18:00","8:30"),"18:00")-MEDIAN(NETWORKDAYS(A1,A1)*MOD(A1,1),"18:00","8:30"))-INT((WEEKDAY($A$1- 6)-$A$1+$B1)/7)*(("18:00"-"8:30")-("12:00"-"9:00"))
This comment was minimized by the moderator on the site
Thank you Sunny, but honestly the updated formula did not give the results properly, not sure if it requires additional adjustment:
Monday - Thursday 8:30-18:00 (working hours)
Friday 9:00-12:00 (working hours)
Saturday - Sunday Off
thank you
This comment was minimized by the moderator on the site
Hi, Pierre, I have tested the formula, it works for me. In the formula:
A1 is the start datetime, B1 is the end datetime, and both of the datetime cells are formated as mm/dd/yy hh:mm, then the result you need to format it as time format: 37:30:55.
https://www.extendoffice.com/images/stories/comments/sun-comment/doc-calculate-specific-work-hour.png
https://www.extendoffice.com/images/stories/comments/sun-comment/doc-calculate-specific-work-hour-2.png
This comment was minimized by the moderator on the site
hi sunny,

I have used the formulla and it is working well except for friday hald day calculation showing in negative hours. Kindly suggest

=((NETWORKDAYS(P9,R9,1)-1)*("15:00"-"07:00")+IF(NETWORKDAYS(R9,R9),MEDIAN(MOD(R9,1),"15:00","07:00"),"15:00")-MEDIAN(NETWORKDAYS(P9,P9)*MOD(P9,1),"15:00","07:00")-INT((WEEKDAY(P9-6)-P9+R9)/7)*(("15:00"-"7:00")-("11:30"-"7:00")))

Start time: 1/12/2024 11:51:02 AM
End Time: 1/12/2024 11:51:13 AM
Result: -3:30:00

Thanks
Nishanth
This comment was minimized by the moderator on the site
Dear all, I would like to ask you for help, I tried this formula for counting working hours between days (without weekends and holidays), but I receive the #Value! error.I formatted the cells as well.
 Start date in A2:  24.11.2021 11:05  <span style="letter-spacing: 0.2px; color: inherit; font-family: inherit; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit;">   1.12.2021 11:05</span>Workday start in C2:    6:00Workday end  in D2:  18:00Holidays in E2 till E10:
1/1/21
4/2/21
4/5/21
5/1/21
5/13/21
5/24/21
10/3/21
12/25/21
12/26/21
    
I used the following formula:   <span style="letter-spacing: 0.2px; color: inherit; font-family: inherit; font-style: inherit; font-variant-ligatures: inherit; font-variant-caps: inherit; font-weight: inherit;">#Value! error, can you please advise?</span>
This comment was minimized by the moderator on the site
Hello Sir,
My predecessor has set below formula.I am not getting  what is "Holidays[#All]", not getting where he has set this.
Please let me know.....


=ABS(IF([@Priority]<3,settings!$F$2-K3,(((NETWORKDAYS(K3,settings!$F$2,Holidays[#All]))*((settings!$B$3-settings!$B$2)*24)-IF(AND(NETWORKDAYS(K3,K3,settings!$D$2:settings!$D$33)>0,(K3-INT(K3))*24>(settings!$B$2-INT(settings!$B$2))*24,(K3-INT(K3))*24<(settings!$B$3-INT(settings!$B$3))*24),((K3-INT(K3))*24)-((settings!$B$2-INT(settings!$B$2))*24),0)-IF(AND(NETWORKDAYS(settings!$F$2,settings!$F$2,settings!$D$2:settings!$D$33)>0,(settings!$F$2-INT(settings!$F$2))*24<(settings!$B$3-INT(settings!$B$3))*24,(settings!$F$2-INT(settings!$F$2))*24>(settings!$B$2-INT(settings!$B$2))*24),((settings!$B$3-INT(settings!$B$3))*24)-((settings!$F$2-INT(settings!$F$2))*24),0)-IF(AND(NETWORKDAYS(K3,K3,settings!$D$2:settings!$D$33)>0,(K3-INT(K3))*24>(settings!$B$3-INT(settings!$B$3))*24),(settings!$B$3-settings!$B$2)*24,0)-IF(AND(NETWORKDAYS(settings!$F$2,settings!$F$2,settings!$D$2:settings!$D$33)>0,(settings!$F$2-INT(settings!$F$2))*24<(settings!$B$2-INT(settings!$B$2))*24),(settings!$B$3-settings!$B$2)*24,0))/24)))
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations