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

后端 未结 3 1732
猫巷女王i
猫巷女王i 2020-12-29 20:18

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.

相关标签:
3条回答
  • 2020-12-29 20:49

    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)
    
    0 讨论(0)
  • 2020-12-29 20:51

    SUMIF didn't worked for me, had to use SUMIFS.

    =SUMIFS(TableAmount,TableMonth,"January")
    

    TableAmount is the table to sum the values, TableMonth the table where we search the condition and January, of course, the condition to meet.

    Hope this can help someone!

    0 讨论(0)
  • 2020-12-29 20:52

    This should work, but there is a little trick. After you enter the formula, you need to hold down Ctrl+Shift while you press Enter. When you do, you'll see that the formula bar has curly-braces around your formula. This is called an array formula.

    For example, if the Months are in cells A2:A100 and the amounts are in cells B2:B100, your formula would look like {=SUM(If(A2:A100="January",B2:B100))}. You don't actually type the curly-braces though.

    You could also do something like =SUM((A2:A100="January")*B2:B100). You'd still need to use the trick to get it to work correctly.

    0 讨论(0)
提交回复
热议问题