Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Excel - Sum column if condition is met by checking other column in same table

Tags:

function

excel

I am trying to create spreadsheet to use in a small retail shop.

I have a workbook which contains expenses figures on a sheet and income figure on another sheet.

We can say that the common ground between the both sheets are the month.

I would like to write a function, which will only select those expenses of a specified month.

Something like -

=SUM(IF( Table4[Month]="January", Table4[Amount]))   // I want the sum of all expenses of a given table for only  // those months which are january etc. 

I tried using the above, but it failed.

like image 206
Kunal Avatar asked Jun 10 '11 16:06

Kunal


People also ask

How do you sum a column in Excel only if another column meets criteria?

If you want, you can apply the criteria to one range and sum the corresponding values in a different range. For example, the formula =SUMIF(B2:B5, "John", C2:C5) sums only the values in the range C2:C5, where the corresponding cells in the range B2:B5 equal "John."

How do you sum values in one column based on values in another column?

(1) Select the column name that you will sum based on, and then click the Primary Key button; (2) Select the column name that you will sum, and then click the Calculate > Sum. (3) Click the Ok button.

How do you sum values based on two criteria in another column in Excel?

If you need to sum numbers based on multiple criteria, you can use the SUMIFS function. The first range (D4:D11) are the cells to sum, called the "sum range". Criteria are supplied in pairs... (range / criteria).

How do you sum a column if two criteria are met?

The first step is to specify the location of the numbers: =SUMIFS(D2:D11, In other words, you want the formula to sum numbers in that column if they meet the conditions. That cell range is the first argument in this formula—the first piece of data that the function requires as input.


1 Answers

Actually a more refined solution is use the build-in function sumif, this function does exactly what you need, will only sum those expenses of a specified month.

example

=SUMIF(A2:A100,"=January",B2:B100) 
like image 117
Alen Avatar answered Sep 21 '22 12:09

Alen