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

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:
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:
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.

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

Related

Why is my COUNTA formula counting too high?

I know a similar but different question has been asked, but I don’t know how to use query or where to learn, so I figured I’d ask…
I’d like to use this formula:
=COUNTA(FILTER($L:$L,OFFSET($L:$L,0,1)="Draw",$L:$L=$E2))
L:L is a range of names, which it should test against E2:E, a range of unique names. I also need to ensure that the cell in the column to the right of each instance of the name in E2:E has a specific word in it (“Draw”). I tried using AND, but this just sets everything to 1, even when one of them has 3 draws. There are no losses, so the loss column should show up as all 0s, but it is instead 1s. The infuriating thing about this is that the draw column is all right for some reason. Picture below. For reference, Losses(as well as draws and wins)are the end goal.
image
COUNT is meant for counting numeric values, COUNTA for non empty cells. COUNTIF or COUNTIFS would probably be your best choice. Try with:
=COUNTIFS($L:$L,E2,OFFSET($L:$L,0,1),"Draw")

Indirect cell reference in Google Sheets with variable input

I am trying to create a funnel analysis where I can play with the time delay between stages to see the impact. I need my formula to reference 1 row up and X columns over, where X is the number located in column B. This is what I have so far:
=(INDIRECT("R[-1]C[2]", false))/$C$16)
Except where you see C[2] - I need the 2 to be a variable fed by a fixed cell reference. I've tried every combination I can think of and have looked at a number of postings on INDIRECT cell reference formulas, but this seems to be one step further. It also seems like a fairly common type of "waterfall" analysis, so maybe I need a completely different approach?
You can use this sample formula:
=OFFSET(A2,-1,$B$1)/$C$16
Just remember to replace A2 with the current cell you are entering the formula from, and $B$1 with the location of the fixed cell reference.
Reference:
OFFSET()

How do I make Google Spreadsheet automatically divide a column into another column?

I'm making a spreadsheet that includes a long list of values, with a column that contains a total of values, and after that an average of the values in the row. I need the averaged column to always be 1/6 of the value in the summed column, but I can't figure out a way to make it automatically calculate it for me for each new row.
So far, I have been doing it all manually (type out all the values, manually add them together for the total, then divide by 6 myself for the average) but I'd really like to automate the math parts. I have not found a single way to properly do this - using "=DIVIDE(K2,6)" as a modified version of a suggestion on this other question (modified to use the column I'm actually putting the numbers in) does literally nothing, and I'd have to manually change and paste it into each row, which is actually harder and more tedious than continuing to do the math myself.
Here's an example image of what my columns look like. All the math is correct so far, I just want to automate it so I can type fewer numbers:
EDIT: Combined answers from Scott and Player0 is what worked! thanks for being patient with me! I was able to also use that to make the Sum column function automatically as well, so both columns are fully automated now! :D
You don't have to enter the formula manually on every line. 
Enter =K2/6 in cell L2; then select cell L2
and drag/fill it down to L12. 
(That means click on the dot in the lower right corner of the cell
and drag it down.) 
Or however far your sheet actually goes. 
That will automatically fill in L3 with =K3/6,
L4 with =K4/6, and so on.
use on row 2:
=INDEX(IFERROR(K2:K/6; 0)
also see: ArrayFormula of Average on Infinite Truly Dynamic Range in Google Sheets

Google Sheets Recursive Array Formula

I'm trying create a list of sequential dates from a set date to the most recent date in another column.
=ARRAYFORMULA(IF(OR(A2:A=MAX(C:C),A2:A=""),"",DATEVALUE(A2:A+1)))
I use MAX() to find the dates most recent date in column C. What I'm trying to get this formula to do is to recursively check the date in the cell above to determine if the max date has been reached. I've made sure A2 already has the set starting date.
The output is in only one cell though and I don't know why.
Thank you for the help.
What appears to be troubling your current array formula is that as defined it goes on forever and is self-referential. There may be a way to make it by setting preferences to be iterative and helping it interpret getting to repeated cells with "" as convergence.
Here is a way to sidestep those issues. You can bulletproof it more (for example, by encasing it in an IFERROR), but basically you can calculate exactly how many entries you need, and then set your range in the Array formula accordingly. In A3 you place the following:
=arrayformula(DATEVALUE(Row(indirect("A3:A"&(max(C:C)-A2+2)))+A2-2))
which will construct the exact range you want, then calculate each entry with an explicit rather than recursive formula.
EDIT: the above implementation assumes you need at least 2 dates. You can handle that case and other weird ones with the following, less readable formula, =if(max(C:C)>A2,iferror(arrayformula(DATEVALUE(Row(indirect("A3:A"&(max(C:C)-$A$2+2)))+$A$2-2))),"")

Google Docs - SUMIF - SUM range if single cell contains a string

I'd like to quickly include or exclude an entire range of values in a SUM.
Presently I'm SUMing select cells for a grand total: [E19] =SUM(E13,E20,E30,E45,E55,E70,E80)
These are in turn SUMs of selected ranges:
... [E30] =SUM(E31:E44), [E55] =SUM(E56:E69), ...etc.
One of these ranges I would like to toggle it's inclusion in the Grand Total.
It seemed the best way to do it was this:
[E45] =SUMIF(D45,"☑",E46:E54)
In short, in cell E45 I'd like to SUM E46 to E54 only if D45 contains a ☑.
However Google Doc's SUMIF seems to only work with matched ranges: =SUMIF(D46:D54,"☑",E46:E54)
Is there a way to SUM a range only if a specific value exists in a single cell?
You're right about SUMIF, it allows you to sum values from a range, which meet a certain criteria (on another range of the same length). For example, if you had two columns called "status" and "price", you could use it to sum all the prices for a given status.
What you're trying to do can be done, instead, with the use of the IF function:
=IF(D45="☑";SUM(E46:E54);0)
If the condition specified in the first argument is true, it will return the second argument, that is, the sum. Otherwise, it will return the third argument, 0.
After working through the logic to share the issue I wound up identifying a solution. Rather than trying to force SUMIF to check a single cell against a range. I just nested the 1:1 SUMIF inside my 'Grand SUM': =SUM(E13,E20,E30,SUMIF(D45,"☑",E45),E55,E70,E80).

Resources