数式項目に関する記事です。入力日付が月初(1日)の場合は翌年の前月末日、月中(2日以降)の場合は翌年の同月末日を自動で算出する数式サンプルと設定手順について説明します。
| [数式 サンプル] 入力された日付が月初・月中で対応する日付を表示する数式 | |
対象の日付項目が「月初(1日)」か「月中(2日以降)」かによって、翌年の異なる末日を自動で表示する数式の設定方法です。
対象の日付項目のAPI参照名: DATE__C(※実際の環境のAPI参照名に置き換えてください)
数式の戻り値のデータ型: 日付
注意: 本番環境へ設定する前に、必ずSandboxなどのテスト環境で動作を確認してください。
以下の数式を数式項目に設定します。
IF (
DAY ( DATE__C ) = 1,
DATE ( YEAR ( DATE__C ) + 1, MONTH ( DATE__C ), 1) - 1,
IF (
MONTH ( DATE__C ) = 12,
DATE ( YEAR ( DATE__C ) + 1, 12, 31),
DATE ( YEAR ( DATE__C ) + 1, MONTH ( DATE__C ) + 1, 1) - 1
)
)
数式の動作
設定した数式は、入力された日付に応じて以下のルールで自動計算を行います。
月初(1日)が入力された場合: 入力日付の翌年の前月の末日を表示する
月中(2日以降)が入力された場合: 入力日付の翌年の同月の末日を表示する
000384896

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.