Search code examples
google-sheetssumifs

Google Spreadsheet: SUMIF sum single cell iteratively for each met criteria


I am trying to sum a single value (in a single cell) for every cell that mets a certain criterion within a range. Consider the following scenario:

enter image description here

My objective is to sum the reference value 10 every time a cell is equal to V, giving a result of 30, in this case. I thought the formulae SUMIF might fit my requirements, so I tried assigning a single cell (the reference cell) as sum_range (more info here), but It only sums the value the very first time the criterion is met by a cell. So far, my approach looks like the following:

=SUMIF(A1:A7;"=V";A4)  // Where A4 is '10'

I am aware that the proper usage of this function is to indicate a sum_range that at least equals the size of the range on which the criterion is looked up. The first logical solution would be to create an additional column next to the analysed range so that:

enter image description here

However, my current project does not allow me doing that, and I would rather prefer keeping the structure as in the first example. I would like to know if there exists any alternative to achieve what I am looking for in the first example.


Solution

  • What about:

    =ArrayFormula(sum(if(A1:A7="V"; 10; 0)))