Formula to Find Count of Even Numbers in Google Sheets - google-sheets

I have found this question/answer useful:
Formula to Find Count of Odd Numbers in Google Sheets
but whilst it works for my array with odd numbers, I also want to count the even numbers and the equivalent with ISEVEN counts blank cells as even numbers giving an incorrect result there. How can I use the ISEVEN function whilst also telling the formula to ignore the blanks? I have tried the "<>" and ISNUMBER in almost every permutation and played around with COUNTIFS, but so far not got anything to work. Please help!

Try these formulas, Take a look at Example Sheet
ODD
=ARRAYFORMULA(COUNTIF(ISODD(FILTER(FLATTEN($A$1:$O$20),FLATTEN($A$1:$O$20)<>"")), TRUE))
EVEN
=ARRAYFORMULA(COUNTIF(ISEVEN(FILTER(FLATTEN($A$1:$O$20),FLATTEN($A$1:$O$20)<>"")), TRUE))
COUNTA
=COUNTA(A1:O20)
Total check "EVEN output + ODD output"
=B22+B23
Blanks
=(ROWS(A1:O20)*COLUMNS(A1:O20))-COUNTA($A$1:$O$20)

Related

VLOOKUP in Google Sheets returns the wrong thing

So I have a Google Sheet and I'm trying to make a Rock, Paper, Scissors game.
Everything works for now, but I'm missing a way to check who wins. I thought of having a range of cells and then use a VLOOKUP to find the winner. But it sometimes returns the wrong thing.
The cells are these:
The left and middle are the ones to check through, and the one on the right would be the winner.
I tried this:
=IF(B2 = J2, "Tie!", VLOOKUP({B2, J2}, X1:Z3, 3, FALSE))
where B2 and J2 are the player's choices, and X1:Z3 is the range mentioned above.
It works most of the time, but sometimes it returns the wrong thing, like:
Everyone knows that Rock wins Scissors, so that is wrong.
VLOOKUP cannot search for multiple search_keys. So, you can combine the search key into a single search_key.
I use b2&j2 So we can modify formula and table
=IF(B2 = J2, "Tie!",VLOOKUP(B2&J2, ARRAYFORMULA({X1:X6&Y1:Y6,Z1:Z6}), 2, FALSE))
Please review it: https://docs.google.com/spreadsheets/d/1XGCLY8-lkozE7Fj-ZWmHHnTcMx7XjZJWPB9PWxHLAOs/edit?usp=sharing

Troubleshooting formula with array - array arguments are of different size to EQ

In Google Sheets, I have a formula that displays the value of an item in a row if one of its cells contains any of the values listed in a different sheet. It looks like this:
=ARRAYFORMULA(IF(OR(L2 = ZRSKUs!$A$1:$Z$12005), O2, "0"))
If L2 contains any of the values in sheet ZRSKUs, this formula displays the value of the item, which is held in O2. If I drag the formula down it produces the value of every column and I can then get a SUM of this column. I wanted a way to do this without having to drag the formula down every single row (this spreadsheet has about 20,000 rows so it takes a long time to do). I also wanted the formula to add it up too, so it is all done in one cell.
I tried editing the formula to do this, and this is what I came up with:
=ARRAYFORMULA(SUM(IF(OR($L3:$L = ZRSKUs!$A$1:$A$500), $O3:$O, "0")))
However, this gives me an "Array arguments to EQ are of different size" error. I tried adjusting the number of rows in the ZRSKUs sheets so it had the exact same number as my other sheet, but this made no difference.
I'm not sure what's going wrong, so any help or advice would be greatly appreciated!
You get the error because that is not a well-formed array formula, as $L3:$L and ZRSKUs!$A$1:$A$500 are not equal in length. We could rectify this by using another function for the lookup, in this case, MATCH:
=ARRAYFORMULA(SUM(IF(ISNA(MATCH($L$1:$L, ZRSKUs!$A$1:$A$500, 0)), 0, $O$1:$O)))

Google Sheets - Indicate which cells sum a value

Sometimes we have customers that, when they pay their EOM account, they pay more or fewer invoices than needed and do not provide a remittance. This makes figuring out which invoices they've paid difficult/time-consuming.
I'm looking for a formula or script that will, for example, look through column A (invoice values) and then highlight or place an X in column B next to the ones that add up to (or closest without going over) a total invoice value in cell C2.
I've been trying to work this out, but nothing is working...
So if C2 is going to be constant, (all rows) you could use a vlookup to find the difference of $A and $C$2.....
Wrapped in an IF to print X if found.....
Wrapped in an IFERROR to remove the #n/as...
So I got
=IFERROR( IF($A2+( VLOOKUP ($C$2-$A2:$A:5,1,false))=$C$2, "X", " "))
And someone smarter than me could probably wrap that in an array formula, but it will work with autofill.

Google Spreadsheet Function That Sums Numbers In A Column When the Row Contains An EXACT Text

I've been at this problem for a while now. I am trying to sum numbers under a specific column when the rows equal a certain text and then display that sum on a different sheet. So far I came up with this formula: =IF(EXACT(A2,Table!A2:A)=TRUE,SUM(Table!C2:C)); however the only problem is that is sums everything in column C (which makes sense).
I wish there was a way to do something like the following: SUM(Table!C2:C where EXACT(A2,TABLE!A2:A)=TRUE). I've also tried the SUMIF(), DSUM(), and QUERY() functions to no avail. I must be getting logically tripped up somewhere.
Figured it out: =SUM(FILTER(Table!E4:E, EXACT(Table!A4:A,A4)=TRUE)).
=sum ( FILTER (b1:b10, a1:a10 = "Text" ) )
// the above formula will help you to take the sum of the values in column B when another column A contain a specific text.
The formula is applicable only in Google Spreadsheets

Make countif ignore "- -" from continue

I'm having trouble with a countif that I am using to count the number of entries in a range. The problem is that the range is populated with an array formula, and when the data changes the cells the array formula added a =CONTINUE(...) to now display -- (minus minus)
=COUNTIF(C6:C, "<>")
Is there a way that the countif could be written to ignore cells with --?
The -- is a way that Google Sheets displays the #VALUE! error. So you can use the IFERROR function to "mask" any of these errors:
=ArrayFormula(COUNTIF(IFERROR(C6:C);"<>"))
or more simply:
=ArrayFormula(COUNTA(IFERROR(C6:C)))
Updated:
Why don't you filter out all cells that are not text or similar to --?
Then use filtered range for countif.
=COUNTIF((ROWS(C6:C)-COUNTIF(C6:C"<>*")) , "ur criteria")
Is there a way your formula array could cast a string other than --?
Check this article
The search you are doing has regular expression.
Writing this on mobile. So please try out and pardon for weird formatting.

Resources