1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Excel SumIf

Last updated at Posted at 2019-08-23

問題

今3行目までが集計の対象、10行目に集計欄を作ります。
その場合、B10とC10のどちらが正しいでしょうか

A B C D
1 支払額 コード
2 1000 旅費 日当 51
3 1100 旅費 交通費 52
10 51 =SUMIF($A$1:$D$3,A10,$A$1:$A$3) =SUMIF($D$1:$D$3,A10,$A$1:$A$3)
11

答え

後者が正しい
SumIf関数は
第一パラメーター[範囲]は検索したい列だけ入れる。
第二パラメーターは値の入ったセルまたは"=51"のように示す。セルのアドレスでもよい。
第三パラメーターは集計したい列だけ入れる。
となる。
公式を読むと、検索と集計をまとめて範囲として指定するようにも読めるが、そうではない。

https://support.office.com/ja-jp/article/sumif-%E9%96%A2%E6%95%B0-169b8c99-c05c-4483-a712-1697a653039b
構文

SUMIF(範囲, 検索条件, [合計範囲])

SUMIF 関数の書式には、次の引数があります。

範囲

必ず指定します。 抽出条件を評価セルの範囲。 各範囲のセルには、数値または名前、配列、または数値が入力されている参照があります。 空の値とテキスト値は無視されます。 選択範囲には、(以下の例) 標準の Excel 形式で日付を含むことがあります。

抽出条件

必ず指定します。 数値、式、セル参照をテキスト、または対象となるセルを定義する関数の形式で抽出条件。 抽出条件を表現して 32、たとえば、">32"、B5「32」、「リンゴ」、または TODAY() します。

合計対象範囲

省略可能です。 追加は、範囲引数で指定されている以外のセルを追加する場合は、実際のセルです。 Excel が範囲引数で指定されているセルを追加する場合は、合計範囲を省略すると、(同じで、セルを検索条件が適用されます)。

"検索条件"

検索条件には、半角の疑問符 (?) または半角のアスタリスク () をワイルドカード文字として使うことができます。 ワイルドカード文字の疑問符は任意の 1 文字を表し、アスタリスクは 1 文字以上の任意の文字列を表します。 ワイルドカード文字ではなく、通常の文字として疑問符やアスタリスクを検索する場合は、その文字の前に、"~" のように半角のチルダ (~) を付けます

ただし、SUMIF 関数の "範囲" と "合計範囲" でセルの数が異なる場合、ワークシートの再計算に予想以上に時間がかかることがあります。

日本語は構成がおかしいが英語も攻勢がおかしい

以下の原文を見るとわかるが、まるでパラメーターが4つあるように読めるが、4番目の項目はCriteriaでワイルドカードが使えるという解説である
しかし本来4番目の項目はCriteriaの後にくるべきである。
https://support.office.com/en-us/article/sumif-function-169b8c99-c05c-4483-a712-1697a653039b?ui=en-US&rs=en-US&ad=US

range

Required. The range of cells that you want evaluated by criteria. Cells in each range must be numbers or names, arrays, or references that contain numbers. Blank and text values are ignored. The selected range may contain dates in standard Excel format (examples below).

criteria

Required. The criteria in the form of a number, expression, a cell reference, text, or a function that defines which cells will be added. For example, criteria can be expressed as 32, ">32", B5, "32", "apples", or TODAY().

Important: Any text criteria or any criteria that includes logical or mathematical symbols must be enclosed in double quotation marks ("). If the criteria is numeric, double quotation marks are not required.

sum_range

Optional. The actual cells to add, if you want to add cells other than those specified in the range argument. If the sum_range argument is omitted, Excel adds the cells that are specified in the range argument (the same cells to which the criteria is applied).

You can use the wildcard characters—the question mark (?) and asterisk (*)—as the criteria argument.

A question mark matches any single character; an asterisk matches any sequence of characters. If you want to find an actual question mark or asterisk, type a tilde (~) preceding the character.

できるネットがわかりやすい

https://dekiru.net/article/4145/
合計値を表示したいセルに「=SUMIF(」と入力する
検索の対象とするセル範囲を選択する([範囲]の設定)
[範囲]の中にある検索条件を文字列や数値で指定する([検索条件]の設定)
合計したい値が入力されているセル範囲を指定する([合計範囲]の設定)
最後に「)」(半角閉じカッコ)を入力してEnterキーを押す

省略すると、[範囲]がそのまま合計の対象となります。は無視すべき

省略しないできちんと指定した方がいいです。そうしないと予期しない動作をします。

まとめ

SumIf関数はパラメーターを3つとも指定する。
第1が検索する列、第2が検索する条件、第3が集計したい列。第3は省略しないこと。(通常は1列しか集計しないのでこういう説明になる。
検索条件はセルを指定。式の場合は二重引用符で囲む。
検索する列と集計したい列は必ず行が一致していること。していない場合は著しく時間がかかることがある。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?