Array of value from multiple conditions - google-sheets-formula

I wanna return an array of value from multiple conditions.
Currently formula is set to accept one condition.
https://docs.google.com/spreadsheets/d/1pgVlBWYKWtT6AEPyRtZmAYdOXBCjYG_B7pdlvCqYq0A/edit?usp=sharing
The desired result is showed in the ad hoc worksheet
Edit : initial problem solved by player0. Thanks !
Previous post
I'm using curly brace to return an array of value with the IF formula. This works well. I wanted to use IFS function because i wanted to use more conditions.
With a similar table, only the 1st number is returned form the array.
I don't understand why.
https://docs.google.com/spreadsheets/d/1pgVlBWYKWtT6AEPyRtZmAYdOXBCjYG_B7pdlvCqYq0A/edit?usp=sharing
Thanks !

delete range E2:L and use this in E2:
=ARRAYFORMULA(TRANSPOSE(SPLIT(TRANSPOSE(QUERY(
IF((E1:L1=B2:B11)+(E1:L1=C2:C11)+(E1:L1=D2:D11);
"1;2;3;4;5;6;7"; ";");;9^9)); ";"; 1; 0)))

Related

CountIFS with filter

Syntax:
CountIfS(Range1, condition1, Range2, Condition2,.... So on)
Can we use FILTER function to retrieve a value.
I am trying below function
=COUNTIFS(A2:A610, "Yes", $B$2:$B$610, FILTER(Sheet2!14:14, Sheet2!2:2=G1))
The output is not correct answer, neither the its throwing any error.
I could save the output of filter(Sheet2!14:14,Sheet2!2:2=G1) in different cell and refer that cell in 2nd condition. But for that I need make plethora cells as I need to use this countifs function in every column.
PS : filter(Sheet2!14:14,Sheet2!2:2=G1) returns the correct value.
that's not how it works. the output of your FILTER formula needs to be exactly 609 cells to match the range of your COUNTIFS formula. only then your formula will work.
in your case try:
=COUNTA(IFNA(FILTER(A2:A; A2:A="yes"; REGEXMATCH(B2:B;
TEXTJOIN("|"; 1; FILTER(Sheet2!14:14; Sheet2!2:2=G1))))))

np.where() with np.linspace()

I am trying to find index of an element in x_norm array with np.where() but it doesn' t work well.
Is there a way to find index of element?
x_norm = np.linspace(-10,10,1000)
np.where(x_norm == -0.19019019)
Np.where works with np.arange() and can find the index either first or last element of array creating by linspace.
The numbers generated by np.linspace contains more decimal places than the one you are pasting to np.where (-0.19019019019019012).
So it might be better to use np.argmin to find the nearest value and avoid rounding errors:
x_norm = np.linspace(-10,10,1000)
yournumber=-0.19019019
idx=np.argmin(np.abs(x_norm-yournumber))
You can then go further and add np.where(x_norm==x_norm[idx]) to your code in case if you'll have array with duplicates.
Set the level of precision to 8 using np.round then use np.where to filter data as a mask then apply the mask to the array.
x_norm = np.round(np.asarray(np.linspace(-10,10,1000)),8)
results=x_norm[np.where(x_norm==-9.91991992)]
print(results)

Countif/Sumif should show empty value instead of 0 in arrayformula

I have a lot of arrayformulas wrapped around countif and sumifs functions. I want the countifs/sumifs to return an empty value ("") instead of 0.
My workaround is very expensive and long:
=ARRAYFORMULA(IF(SUMIFS(Sheet!$C$1:$C; 'Sheet!$A$1:$A; ">="&$A3; Sheet!$A$1:$A; "<="&$B3)=0; ""; SUMIFS(Sheet!$C$1:$C; Sheet!$A$1:$A; ">="&$A3; Sheet!$A$1:$A; "<="&$B3)))
Here is an example sheet: https://docs.google.com/spreadsheets/d/1xyS0Y4gnG3zLyOGtycWytvTlA1NmqjEAy8H7QJatdSg/edit?usp=sharing
Is there a different way for this?
=IFERROR(SUM(QUERY(Sheet2!A:C;
"select C
where month(A)+1="&MONTH(A3)&"
and year(A)="&YEAR(A3); 0)))
=IFERROR(SUM(FILTER(Sheet2!C:C;
YEAR(Sheet2!A:A)=YEAR(A3); MONTH(Sheet2!A:A)=MONTH(A3))))

How to get an array of values where columns match multiple criteria

I have a table of data similar to:
where I'd like to get just the shapes which match a set of given criteria (in this case week=2 and colour=blue).
I can return the first result using index and match like:
=ArrayFormula(INDEX(C2:C14,MATCH($F$1&$F$2,A2:A14&B2:B14,0)))
but I'd like to return the all matching values (eg square and triangle) in to the range F3:Fsomething. This would preferably be done using a formula that returns a range and isn't "copied-down", as a list of all possible shapes isn't known beforehand.
How can I modify this formula to achieve this?
See if this works:
=FILTER (C2:C14, B2:B14=F2, A2:A14=F1)
to do multiple criteria you want to use * like so
=FILTER (C2:C14, (B2:B14=F2) * (A2:A14=F1))
and if you want the results all in the same cell with a delimiter, use TEXTJOIN
=TEXTJOIN([DELIMETER],[IGNORE EMPTY TEXT],text1)
=TEXTJOIN(", ",TRUE,FILTER(C2:C14,(B2:B14=F2)*(A2:A14=F1)))

jqGrid permutation array

In jqGrid I am trying to use the permutation array for saving the reorder state of the columns.
For eg. Basic column state is perm = [0,1,2,3,4] column 3 is hidden and column 0 is the checkbox. Now I have a custom context menu which I use to finally give me a perm array of [0,1,3,2,4]
I have read in the documentation that the permutation array needs to start with 1, is this right?
When I try using "remapColumns" functions of the jqgrid and pass the perm array, it works fine. But if I try hiding and showing columns a couple of times, the column order is getting messed with.
Please help me understand what these indices for the permutation array stand for? Are they column indexes for visible columns? Should hidden columns be part of array? What happens in case of frozen columns? In some examples I have seen perm = [0:1, 1:3, 2:2, 3:1]
What is the correct way? I am using grid.jqGrid("remapColumns", perm, true);
Try to use also the last parameter of the function
grid.jqGrid("remapColumns", [0,1,3,2,4], true, false);
permutation, updateCells, keepHeader
wiki:methods

Resources