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

日付が祝日であるかどうかを確認し、Excelで祝日を除く日数を数える方法は?

たとえば、日付のリストがあり、リストに祝日が存在するかどうかを確認したい場合、どうすればそれをすばやく実行できますか? この記事では、特定の年内のアメリカの祝日のすべての日付を計算する方法を示し、Excelで日付がアメリカの祝日であるかどうかを簡単に確認します。


パート1:Excelで特定の年の祝日を計算する

日付が祝日であるかどうかを確認する前に、Excelで特定の年内のすべての祝日を一覧表示する必要があります。 したがって、次のスクリーンショットのようにテーブルを準備すると、作業が簡単になります。

祝日かどうかのドキュメントチェック1

アメリカの祝日にはXNUMX種類あります。

(1)第1種は、元日がXNUMX月XNUMX日であるなど、決まった日の祝日です。 次の式で元日を簡単に計算できます = DATE(Given Year、1,1);

(2)第XNUMXの種類は、大統領の日などの決まった平日の祝日です。 大統領の日は次の式で簡単に計算できます = DATE(Given Year、1,1)+ 14 + CHOOSE(WEEKDAY(DATE(Given Year、1,1))、1,0,6,5,4,3,2);

(3)最後の種類はメモリアルデーです。メモリアルデーは次の式で簡単に計算できます。 = DATE(Given Year、6,1)-WEEKDAY(DATE(Given Year、6,6)).

ここでは、すべての祝日を計算する式を次の表に示します。 数式を適切なセルに入力して、を押すだけです 入力します XNUMXつずつキーを押します。

休日 セル
新年の日 C2 = DATE(C1,1,1)
マーティンルーサーキングジュニアデー C3 = DATE(C1,1,1)+ 14 + CHOOSE(WEEKDAY(DATE(C1,1,1))、1,0,6,5,4,3,2)
大統領の日 C4 = DATE(C1,2,1)+ 14 + CHOOSE(WEEKDAY(DATE(C1,2,1))、1,0,6,5,4,3,2)
メモリアルデー C5 = DATE(C1,6,1)-WEEKDAY(DATE(C1,6,6))
独立記念日 C6 = DATE(C1,7,4)
労働者の日 C7 = DATE(C1,9,1)+ CHOOSE(WEEKDAY(DATE(C1,9,1))、1,0,6,5,4,3,2)
コロンブス記念日 C8 = DATE(C1,10,1)+ 7 + CHOOSE(WEEKDAY(DATE(C1,10,1))、1,0,6,5,4,3,2)
退役軍人の日 C9 = DATE(C1,11,11)
感謝祭 10 = DATE(C1,11,1)+ 21 + CHOOSE(WEEKDAY(DATE(C1,11,1))、4,3,2,1,0,6,5)
クリスマス 11 = DATE(C1,12,25)

注: 上記の表の数式では、C1は特定の年を特定する参照セルです。 この例では、2015年を意味し、必要に応じて変更できます。

これらの式を使用すると、特定の年の祝日の日付を簡単に計算できます。 以下のスクリーンショットを参照してください。

祝日かどうかのドキュメントチェック2

将来再利用するために、範囲を定型句(残りのセル形式と数式)として保存します

セルを参照し、各休日を計算するための数式を適用するのは非常に面倒です。 Kutools for Excelは、次のかわいい回避策を提供します。 定型文 範囲を定型句として保存するユーティリティ。セルの形式と数式を範囲内に残すことができます。 そして、ワンクリックでこの範囲を再利用します。 ワンクリックでこの表を挿入し、この表の年を変更するだけで作業が簡単になります!


広告オートアメリカンホリデー1

Kutools for Excel - 300 以上の必須ツールで Excel を強化します。 クレジット カードは必要なく、全機能を備えた 30 日間の無料トライアルをお楽しみください。 今すぐ入手

パート2:日付がExcelで祝日かどうかを確認する

特定の年の祝日のすべての日付を一覧表示した後、Excelの数式を使用して、日付が祝日であるかどうかを簡単に確認できます。 次のスクリーンショットのような日付リストがあると仮定して、それを簡単に実行する方法を紹介します。

日付リストの横にある空白のセルを選択し、セルB18と言い、数式を入力します = IF(COUNTIF($ C $ 2:$ D $ 11、A18)、 "Holiday"、 "No") その中に、フィルハンドルを必要な範囲までドラッグします。 上記のスクリーンショットを参照してください。

ノート:

(1)式= IF(COUNTIF($ C $ 2:$ D $ 11、A18)、 "Holiday"、 "No")で、$ C $ 2:$ D $ 11は特定の年の祝日の範囲であり、 A18は、祝日かどうかを確認したい日付のセルであり、必要に応じて変更できます。 また、この数式は、特定の日付が祝日である場合は「休日」を返し、そうでない場合は「いいえ」を返します。

(2)この配列式を適用することもできます = IF(OR($ C $ 2:$ D $ 11 = A18)、 "Holiday"、 "NO") 対応する日付が休日かどうかを確認します。


パート3:Excelで週末と休日を除くXNUMX日間の日数を数える

パート1では、特定の年のすべての休日をリストしました。この方法では、日付範囲内のすべての週末と休日を除く日数をカウントするためのガイドが表示されます。

日数を返す空白のセルを選択し、数式を入力します = NETWORKDAYS(E1、E2、B2:B10) それに、を押して 入力します キー。

Note:上記のセルで、E1は指定された日付範囲の開始日、E2は終了日、B2:B10はパート1で計算した休日リストです。

祝日かどうかのドキュメントチェック6

これで、指定した日付範囲の週末と休日を除く日数を取得できます。

Excelでセル参照を変更せずに、数式を正確に/静的にコピーします

Kutools for Excel 正確なコピー ユーティリティを使用すると、Excelでセル参照を変更せずに複数の数式を簡単にコピーして、相対セル参照が自動的に更新されないようにすることができます。


広告の正確なコピー式3

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 (9)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
Like the Observed Holiday, I need to also recognize additional days off outside of the Holiday or observed holidays. Example: If Christmas is on a Friday, I need to calculate the days before and after (until New Years) off.
This comment was minimized by the moderator on the site
How would you calculate 15 calendar days from a given date including weekends but excluding holidays using a list/table of holiday dates?
This comment was minimized by the moderator on the site
How to make it show the actual name of the holiday instead of just "holiday"?
This comment was minimized by the moderator on the site
Hi KC,
You can change the text “holiday” to INDEX($A$1:$A$11,MATCH(A18,$C$1:$C$11,0)) in the formula, and the whole formula will be changed to
=IF(COUNTIF($C$2:$C$11,A18),INDEX($A$1:$A$11,MATCH(A18,$C$1:$C$11,0)),"No")

Please note that the dates you will check should be placed in one column.
This comment was minimized by the moderator on the site
Thanks, I have worked out a system to determine whether a public holiday is a weekday, but this also gives an alternative. The problem is that if one does it per month, then there are gaps between days where public holidays occur during weekdays. An example as below taking part of December 2017. the figures to immediate right of dates (Col B) are the WEEKDAY values. If date falls on a Saturday or Sunday (value 6 or 7) then the C Column reflects a blank cell ("") if a weekday the Cell has a "1", if a Public Holiday during a weekday then a "0" 21/12/2017 4 1 22/12/2017 5 1 23/12/2017 6 24/12/2017 7 25/12/2017 1 0 26/12/2017 2 0 27/12/2017 3 1 28/12/2017 4 1 29/12/2017 5 1 30/12/2017 6 31/12/2017 7 I can then sort manually using the Filter approach to get the 1's in one continuous column of rows without the blanks or 0's. Copy and paste to a worksheet where I can import the data into the temperature charts. I am trying to get the filter section automated either via formula by deleting all the 0's and blank cells with the resultant shifting up of cells containing the 1's, or via VBA. The ultimate prize would be combining the steps in Column A and Column C into one formula. The end game is to populate a temperature chart with the workday name and in the next corresponding row the day of the required month Mon Tue Thu Fri 7 8 10 11 Using August as an example where the 9th is a public holiday that falls during a work day, resulting in the data relating to the Wed being removed and the rest of the column shifting up one (or more) places. Then transposed into the above cells. I hope I am explaining with sufficient clarity :-)
This comment was minimized by the moderator on the site
How could I make this work for Federal Holiday? Meaning if the date of a holiday happens to fall on a weekend then the Federal holiday would either be Friday or Monday.
This comment was minimized by the moderator on the site
I used the formulas above to calculate the actual day of the holiday and made a second column for Observed holiday. I made this formula to accomplish this: =IF((WEEKDAY(B15))=1,B15+1,IF((WEEKDAY(B15))=7,B15-1,B15)). The cell reference B15 is referring to the holiday which is in the actual holiday column, in this case New Years Day. When the actual holiday falls on a Saturday, the Observed holiday will be listed as Friday and for actual holidays falling on Sunday, the observed holiday will be listed as Monday. Hope this helps.
This comment was minimized by the moderator on the site
This is an accurate function which will work for New Years Day that would fall on a weekend (years 2022 and 2023): =WORKDAY(DATE(CalendarYear,1,1),--(WEEKDAY(DATE(CalendarYear,1,1),2)>5))
This comment was minimized by the moderator on the site
trying to make a formula for subtracting CALENDAR DAYS and holidays. I have been able to figure out for WORKDAYS and HOLIDAY, but I cannot figure out how to do CALENDAR days and holidays. here is what I am currently using for WORKDAYS AND HOLIDAYS. Help! So I need this to be CALENDAR days instead of WORKDAYS.] =WORKDAY(B28-5,1,HOLIDAYS)
There are no comments posted here yet
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations