Advanced-excel-functions-advanced-excel-date-time-datedif-function

提供:Dev Guides
移動先:案内検索

日付と時刻-DATEDIF関数

説明

DATEDIF関数は、2つの日付間の日数、月数、または年数を計算します。 この関数は、Lotus 1-2-3との互換性のために提供されています。

構文

DATEDIF (start_date,end_date,unit)

引数

Argument Description Required/Optional
Start_date

A date that represents the first, or starting, date of the period.

日付は、引用符で囲んだテキスト文字列として入力できます(例: 「2001/1/30」)、シリアル番号(例: 36921(1900年の日付システムを使用している場合は2001年1月30日を表します)、または他の数式や関数の結果として(例: DATEVALUE( "2001/1/30"))。

Required
End_date A date that represents the last, or ending, date of the period. Required
Unit

The type of information that you want returned.

以下のユニット表をご覧ください。

Required

ユニット表

Unit Returns
"Y" The number of complete years in the period.
"M" The number of complete months in the period.
"D" The number of days in the period.
"MD" The difference between the days in start_date and end_date. The months and years of the dates are ignored.
"YM" The difference between the months in start_date and end_date. The days and years of the dates are ignored
"YD" The difference between the days of start_date and end_date. The years of the dates are ignored.

ノート

  • Excelは、日付を計算に使用できるように、連続したシリアル番号として保存します。 1900年1月1日はシリアル番号1、2008年1月1日はシリアル番号39448です。1900年1月1日から39,447日後だからです。
  • DATEDIF関数は、年齢を計算する必要がある数式で役立ちます。

適用範囲

Excel 2007、Excel 2010、Excel 2013、Excel 2016

DATEDIF関数