Google Sheets Countif range is greater than range - google-sheets

So, quite simply I am trying to count if B4>A4 and B5>A5... ect.
I could do something like this:
=COUNTIF(B4,">"&A4)+COUNTIF(B5,">"&A5)+...
There's got to be a better way using ranges. (Sorry if that formula doesn't actually work)
The formula I have right now:
=COUNTIF(B$4:B30,">"&A$4:A30)
(this is in cell B31)
I've tried many different ways of doing this, but none of them have worked so far. This includes:
-using COUNTIFS
-Having the range include A ("A$4:B30")
-Having the criteria contain both sides (B$4:B30&">"&A$4:A30)
-Not using quotes
-I tried using ARRAYFORMULA and that gave me a mess. But I'm also not that great with ARRAYFORMULA so I might be doing something wrong.

try:
=INDEX(SUM(N(B4:B30>A4:A30)))

Related

Exact criteria match in a Arrayformula

I have a formula that work perfectly in google sheet except that the criteria in the sumif sections have to be case sensitive match.
=ARRAYFORMULA(IF(A:A="Account ID","Total",SUMIF('Report'!C2:C,A:A,'Report'!E2:E)+SUMIF('Report'!$B$2:$B,A:A,'Report'!$E$2:$E)))
I've try with EXACT and FIND but couldn't figure out how to make it work
Use FILTER, like this:
=MAP(A:A,LAMBDA(ζ,IF(ζ="Account ID","Total",SUM(FILTER(Report!E2:E,EXACT(Report!B2:B,ζ)+EXACT(Report!C2:C,ζ))))))

how can I write a formula that uses a cell's contents when building a range reference to the name of another sheet?

I have a large Google Sheets spreadsheet that has individual sheets for financial statements of activity for multiple years. I want to reference particular columns of those in other sheets, and I've successfully figured out how to do that with an HLOOKUP function. However, because I want to do this for multiple years, I'd like that HLOOKUP function to pick up the name of the sheet to reference from its column header. Right now, I'm hard-coding it like this—you can see the HLOOKUP range refers to cells in the "2021 Overall" sheet. The hard-coded approach works but makes adding a new year tedious. Ideally, the HLOOKUP formula would read the contents of its column header cell to determine which year it is.
As best I can tell, the solution is to use INDIRECT, but I can't figure out any way to build the formulate with INDIRECT and not get an error. For instance, this seemed like it should work. As you can see, I have 2021 in cell D4, and my INDIRECT statement is referencing that and building the rest of the range.
I've also tried using INDIRECT with an explicit CONCATENATE, with no more success.
Any ideas for how to look up that D4 cell and slide it into the HLOOKUP range?
Thank you!
Try to remove the "'"& before D4 and the ' after the Overall.
Your formula should look like this:
=IFERROR(HLOOKUP($A$2,INDIRECT(F4 &" Overall!$A$5:$X$150", Utility!$A10, FALSE)))
With Nikko's nudges in the right direction, I eventually figured out the right format. This allows the formula to work in multiple sheets and to be filled right (for more years) and down (for more classes).
=IFERROR(HLOOKUP($A$2,INDIRECT("'"D$4&" Overall'!$A$5:$X$150"), Utility!$A3, FALSE))
Note that if you try to replicate this, you may need to type the formula out from scratch—I had a problem where pasting it in didn't work. Once I'd retyped it and Google Sheets acknowledged it, it worked from then on in the spreadsheet, even when pasted from sheet to sheet.

Google Sheets: Is it possible to simplify this formula? Preferably, I'd like it to calculate all the cells in the row

Can the following formula be simplified as described in the paragraph below it?
=(ABS(D$3-D5)+ABS(E$3-E5)+ABS(F$3-F5)+ABS(G$3-G5)+ABS(H$3-H5)+ABS(I$3-I5)+ABS(J$3-J5)+ABS(K$3-K5))/-1
The problem is that I don't know how many columns I'm going to end up with, and I certainly don't want to continue manually writing each column into the formula. Is there I way to simplify this formula so that every column in a row is calculated?
I've been trying various formulas to no avail, and I can't get usable results via Google searches. I suppose I don't know how to effectively word the question without writing a paragraph.
Thanks, in advance!
Try this one:
=-SUM(ARRAYFORMULA(ABS(D$3:$3 - D5:5)))
GOT IT:
=ArrayFormula(SUM(ABS(D$3:$3-D5:5))/-1)

Google Spreadsheet: SUMIFS for same Column

I've got a problem in Google Spreadsheets:
I don't know why, but for Google there is a problem to use the SUMIFS formula.
When I try to use the SUMIFS formula for different criteria, for the same column, the output is always zero 0.
I tried aleady other things, but anyways it doesn't work.
Here are my examples:
Example 1
=SUMMIFS('Sheet1'!G1:G100;'Sheet1'!C1:C100;"Criteria1";'Sheet1!C1:C100;"Criteria2";'Sheet1'!D1:D100;"Criteria3")
Example 2
=SUMMIFS('Sheet1'!G1:G100;'Sheet1'!C1:C100;{"Criteria1" ;"Criteria2"};'Sheet1'!D1:D100;"Criteria3")
Example 3
=SUMMIFS('Sheet1'!G1:G100;'Sheet1'!C1:C100;"*Criteria1"&"Criteria2";Sheet1'!D1:D100;"Criteria3")
Non of these work. I dont know what I should do. Anyone has an idea?
Thanks in Advance
This behavior is probably correct. SUMIF criteria are connected AND not OR. This means all criteria need to be true.
So if you have two criteria on the same column it is very likely that only one of them can be true at the same time. Eg. column C can not be "Car" and "Book" at the same time. Therefore it is never count into the sum and always results 0.
To OR connect criteria have a look here: SUMIFS with OR.
this formula works:
=SUM(ARRAYFORMULA(SUMIF('Sheet1'!G1:G100;'Sheet1'!C1:C100 & 'Sheet1'!C1:C100 ;{"Criteria1";"Criteria2"} ; 'Sheet1'!D1:D100;"Criteria3")))
Anyways the bad thing is, that this formula cant disting date criterias.
Example1:
=SUMIFS(G2:G100;D2:D100;">=01.06.2011";F2:F100;"<=30.07.2011")
Does work, but this example 2 doesnt work:
Example 2:
=SUM(ARRAYFORMULA(SUMIF(D2:D100 & F2:F100;">=01.06.2011"&"<=30.07.2011";G2:G100)))
I Dont know why it doesnt work, has anybody a solution for this ?
Thanks in advance.

Google Sheet Arrayformula with multiple mathematical functions

How would I go about formatting an arrayformula for this?:
=$D10*(sum($F10:$I10))
I've tried a few different ways but none of them work. I have a bunch of rows with that formula (where of course the row number matches, so for example:
=$D10*(sum($F10:$I10))
=$D11*(sum($F11:$I11))
=$D12*(sum($F12:$I12)) etc...
I need this formula in each row but I'm trying to figure out an arrayformula so that it works when I add or subtract rows.
Thanks for your help!
UPDATE************************************************************************
I've just figured out that =arrayformula(D7:D*(F7:F+G7:G+H7:H+I7:I)) works but I might need to add and subtract columns too. Is there a way to make it work with sum()?
I believe MMULT can be a good alternative:
=ArrayFormula(if(len(D2:D), D2:D*mmult(N(F2:I),transpose(column(F2:I2)^0)),))
Change ranges to suit.
The best way to solve math problem is to split it.
You have two multipliers: D x sum(F:F)
The first task is to make ArrayFormula with D. It's simple:
=ArraFormula(D10:D1000)
And the hard part is to make ArrayFormula with sum. This part was already asked and answered here by AdamL. In your case:
=ArrayFormula(SUMIF(IF(COLUMN(F1:I1),ROW(A10:A1000)),ROW(A10:A1000),F10:I1000))
And your final formula is
=ArrayFormula(D10:D1000 *
SUMIF(IF(COLUMN(F1:I1),ROW(A10:A1000)),ROW(A10:A1000),F10:I1000))

Resources