Error in max-if function . - google-sheets

I am not able to work around a max-if formula in google sheets . What am I doing wrong ?
https://docs.google.com/spreadsheets/d/1BfGX85iur0Nk1gjsa-lZ3hnFnNNvgK9rFgTkOvhFSIw/edit?usp=sharing
In cell K3 , have inserted a formula where it picks the highest amount from column F when column A matches H3. This works perfectly in cell K2 but I fail to understand whats gone wrong in the subsequent rows.

change
=max(IF(A:A=H2,F:F)) to =max(filter(F:F,A:A=H2))

If you want to use your own formula you'll need to insert ArrayFormula.
=max(ArrayFormula(IF(A:A=H2,F:F)))

Related

Google sheets match index arrayformula

I have a count using a formula that needs to be stretched (the formula is in cell F9
) https://docs.google.com/spreadsheets/d/1sZM1aAuqkHNONJWagiu3aTw6_vfw515gbiKwhKuQAD4/edit#gid=1464536028
=IF(ISBLANK(E9);;IF(O9=TRUE;INDEX('Тех Лист'!$F$2:$M$2;MATCH(TRUE;Q9:X9;0));IF(P9=TRUE;INDEX('Тех Лист'!$F$3:$M$3;MATCH(TRUE;Q9:X9;0));"Ошибка!")))
I tried to remake it under Arrayformula, but nothing came of it ... later I got the idea to do it through query, but when I add query to the array, the data I need disappears
=INDEX(split(FLATTEN(TRANSPOSE({'Стадник'!$D9:D&"x"&'Стадник'!$Q8:$X8&"x"&'Стадник'!Q9:X&"x"&'Тех Лист'!$F$2:$M$2&"x"&'Тех Лист'!$F$3:$M$3}));"x"))
Please tell me how I can compare the headers, and if the list is TRUE, take the sum from the table
In G9 I entered
=ArrayFormula(if(len(E9:E); vlookup(trim(transpose(query(transpose(if(Q9:X; Q8:Y8;));;50000)))&""; transpose('Тех Лист'!E1:M3)&""; if(O9:O; 2; if(P9:P; 3;));0)+0;))
Note that this solution requires that only one checkbox can be ticked in the range X9:X.
See if that helps ?

Fetch the last filled cell per row in a given range

I would like to have a formula in column B, which fetches the data from the last non-blank cell in the range D:H. I have hard-plugged the data in column B to highlight what the desired formula should give me in the end >> the latest value on the timeline.
I have not figured out how to solve this issue using a formula, which would not require a concatenation of IF clauses.
Try, in B2
=index(D2:2,(MATCH(9^9, D2:2,1)))
If you put this formula in column b, it will grab the farthest value to the right, which I think is what you want to do?
=SUBSTITUTE(right(SUBSTITUTE(TEXTJOIN("?",TRUE,D2:H2),"?",REPT("!",50)),20),"!","")

Google Sheet Issue in If function with array formula

Am facing issue in google sheet "if" function as discussed below:
In Cell B4 of the Google Sheets (link is given below) am using below formula and then by draging the formula am getting correct result :
=if(isblank(C4) , B3 , C4 )
But when I use the same formula with ARRAYFORMULA am getting the error. The ARRAYFORMULA is applied in cell A4:
=ARRAYFORMULA(if(isblank(C4:C) , A3:A , C4:C ))
Help on how to fix the error with ARRAYFORMULA in above case would be greatly appreciated.
Below is the link of the sheet:
https://docs.google.com/spreadsheets/d/1fB31msHFWDVv9eweb2H0XJ6zDfpKjxEZG9bpXb36_44/edit#gid=0
Limit the number of rows and apply this formula in third row wherever you need
This is explaned here https://infoinspired.com/google-docs/spreadsheet/fill-blank-cells-with-the-values-above/
The reason is that when lookup find an error in the key, it takes the number immediatly lower. It's why we divide the row by 0 when the cell is empty.
=ArrayFormula(lookup(row(C3:C),row(C3:C)/if(C3:C<>"",1,0),C3:C))
To make it work go to
"File" --> "Spreadsheet settings" --> "Calculation" --> "Iterative calculation"
There you press On and nothing else.
It now works.
Good read: Choose how often formulas calculate

Google Sheets: ArrayFormula: Add Previous Value Err If First Value Is Text

The ArrayFormula I'm using is doing a cumulative calc, so col D is cumulative... eg =D1+C2 etc. Works fine when I create the ArrayFormula except for the first calc - since D1 is a header (text), not a number.
I tried an IF(), to check IsNumber(), but no good, same error. Any suggestions on how to correct this error?
Sorry, just fixed it. I had tried to use IFERROR(), but did it incorrectly before, now works when I use:
=ArrayFormula(iferror(D1:D1957+C2:C1958,C2:C1958))

Google Sheets right() in Sum in Arrayformula returning false values

I've a column of sample data where each cell is either blank or (3 alpha chars, 1 white space, 1 digit). For example:
I need to check if the cell begins with "GTR" or "DBT", then return the number, and sum the return of the column. I'm using the formula below:
=ARRAYFORMULA(sum(IF(OR(left(A1:A10,3)="GTR",left(A1:A10,3)="DBT"),VALUE(right(A1:A10,1)),0)))
The problem is that instead of returning 20, it returns 52.
In fact it appears to return the last char of any cell in the range. (eg. if "A5" has a value of 'someText' the formula returns an error because value() can't parse 't' into a number.
I'd like to know if anyone can tell me how to solve this problem, or if there's something wrong with my formula?
Here's an example of this problem in a Google Sheet:
https://docs.google.com/spreadsheets/d/1XNVUWhI43UW2ABrja8rmplmxhhkSu-je45F-9F_3GQM/edit#gid=0
Thanks,
Onji
The ArrayFormula plus OR will evaluate to TRUE if any of the cells in the range is in the codition, to overcome this remove the OR, and add an IF for every condition, as such:
=ARRAYFORMULA(sum(IF(left(A1:A10;3)="GTR";VALUE(right(A1:A10;1));0);IF(left(A1:A10;3)="DBT";VALUE(right(A1:A10;1));0)))
In addition to the solution of Kriggs, this formula should also work:
=ArrayFormula(sum(if(regexmatch(B3:B12, "GTR|DBT")=TRUE, right(B3:B12)+0,)))

Resources