Is there a way to simplify multiple "greater than to"? - google-sheets

My goal is to simplify this formula. The problem is, I have limited knowledge of Excel. So I rely on the If logical operators. And, as consequence, the if formula is quite long for just 1 column.
The overview:
The current formula:
=IF(G10<C$3,F10>D$3, IF(G10<C$4,F10>D$4, IF(G10<C$5,F10>D$5, IF(G10<C$6,F10>D$6, IF(G10>C$7,F10>D$7)))))

Just thought of another idea:
=INDEX(IF(F11:F<>"",LOOKUP(G11:G,C3:C7,D3:D7)<F11:F,""))
This will now spill-down results and will update these when you add more data.

Related

ARRAYFORMULA should be used only once in each formula or should it be used multiple times once for each need?

Sum the VLOOKUP results:
=ARRAYFORMULA(SUM(IFERROR(VLOOKUP(A1:A,B1:C,2,FALSE))))
Sum two cells:
=(Z1+Z2)
Sum two specific values from VLOOKUP:
=ARRAYFORMULA(SUM(IFERROR(VLOOKUP(G1:G2,H1:I,2,FALSE))))
Now I need to come up with an average of the three results:
=ARRAYFORMULA(
SUM(IFERROR(VLOOKUP(A1:A,B1:C,2,FALSE)))+
(Z1+Z2)+
SUM(IFERROR(VLOOKUP(G1:G2,H1:I,2,FALSE)))
)/3
But the faithful form would be:
=(
ARRAYFORMULA(SUM(IFERROR(VLOOKUP(A1:A,B1:C,2,FALSE))))+
(Z1+Z2)+
ARRAYFORMULA(SUM(IFERROR(VLOOKUP(G1:G2,H1:I,2,FALSE))))
)/3
Both will reach the same result, my question is, what is the most correct and safe way from the standards of those who work professionally with Google Sheet?
1 → Use only one ARRAYFORMULA call for the all the formula.
2 → Use multiple ARRAYFORMULA calls, one for each specific need.
Question reason:
I still haven't found risks of using a single ARRAYFORMULA in the beginning and doing everything else within it like =ARRAYFORMULA((...)+(...)) rather than =ARRAYFORMULA(...)+ARRAYFORMULA(...), but I not finding risks doesn't mean they don't exist.
One instance of ArrayFormula on the outside is both sufficient and the professional standard.
However, I must say that I don't understand your formula usage or intention from your posted example. You've got + between each element, which is redundant to SUM. And like ArrayFormula, you only need one outer SUM to sum all elements in your usage.

Is there a way to remove entries based on condition in =filter?

Image of google sheets:
I probably did not phrase my question accurately. Is there a way to remove the result 'a' because it fulfils the '<>1' condition? I am pretty sure a mixture of query and arrayformula is needed but I can't figure it out.
I am aware I can split it into multiple columns to achieve what I want but I am looking for a solution that requires only 1 formula.
More information would be helpful here, but if I understand your screenshot correctly you should be able to do this easily with the QUERY or FILTER function. Below is a query sample that would satisfy your >3 filter requirement
=QUERY(A1:B20, "SELECT B WHERE A > 3")
Where A1:B20 is your data range

Converting a multi column range into one column

I have an instance where I would love to be able to get a column of all the unique names in a range. The problem I am having is that the range is multicolumn.
Let's assume my data is in A1:B3
This works fine if I do:
=unique({A1:A3;B1:B3;C1:C3})
But if that range is named and I do
=unique(NamedRange) or =unique(A1:C3)
Then it will spill over the column. Worse if I want to filter or sort the results in the same formula and then run into errors because the formulas want single column/row or the rows/columns don't match anymore.
I don't deal with named ranges a lot, but I did just make a formula today that had 10 columns in it that I stuck into a range like that so that I could do a complex (for me) filter that gave me the difference of two different ranges, similar to: =FILTER({B4:B93;C4:C93;D4:D93;E4:E93;F4:F93}, NOT(COUNTIF(H5:H, {B4:B93;C4:C93;D4:D93;E4:E93;F4:F93}))). I would REALLY love if I could clean that up and make that messy set B4:F instead.
Is there any formula level function that could stick these all in one column?
Usually I am looking to do other things with it like sort and filter and the multiple columns get even messier.
Thanks for your time. I DID try searching for this, but I could not seem to find the answer.
Use FLATTEN:
=UNIQUE(FLATTEN(A1:C3))
or
=UNIQUE(FLATTEN(NamedRange))

SUMIFS redundancy

I'm trying to make the following formula a bit less redundant, as it may grow out of proportion with some of the modifications i'm looking to perform.
Any advice would be appreciated.
=minus(SUMIFS(A$2:$A,C$2:$C,K$3)-sumifs(A$2:$A,C$2:$C,K$2),SUMIFS(A$2:$A,C$2:$C,K$5)-sumifs(A$2:$A,C$2:$C,K$4))
Please see the worksheet
Try this standard formula:
=SUMPRODUCT($A$2:$A$1000,($B$2:$B$1000=$C$3)+($B$2:$B$1000=$C$4))
-SUMPRODUCT($A$2:$A$1000,($B$2:$B$1000=$C$2)+($B$2:$B$1000=$C$5))
Basically groups the result of the criteria to be added and the ones to be subtracted

Hard-coded comparisons

I am making a calculator style spreadsheet for quickly and easily calculating normally tedious equations into a few simple clicks. However, I have hit a snag.
In B3 I have a list of various possible selections for the user. Depending on what they select, multitudes of other cells will change values to display the correct and needed information.
My first attempt to try to get a cell to format dependent upon the contents of B3 used:
=IF(ISNUMBER(SEARCH("Plate",B3)),"Quake",ISNUMBER(SEARCH("Cloth",B3)),"Ocean",ISNUMBER(SEARCH("Leather",B3)),"Typhoon",ISNUMBER(SEARCH("Neck",B3)),"Earth",ISNUMBER(SEARCH("ring",B3)),"Earth",ISNUMBER(SEARCH("Dagger",B3)),"Mountain",ISNUMBER(SEARCH("Sword",B3)),"Summer",ISNUMBER(SEARCH("Katana",B3)),"Sky",ISNUMBER(SEARCH("Club",B3)),"Autumn",ISNUMBER(SEARCH("Shortspear",B3)),"Winter",ISNUMBER(SEARCH("Axe",B3)),"Typhoon",ISNUMBER(SEARCH("Greatsword",B3)),"Desert",ISNUMBER(SEARCH("Nodachi",B3)),"Lightning",ISNUMBER(SEARCH("Greataxe",B3)),"Desert",ISNUMBER(SEARCH("Greatclub",B3)),"Sunset",ISNUMBER(SEARCH("Longspear",B3)),"Squall",ISNUMBER(SEARCH("Shield",B3)),"Quake",ISNUMBER(SEARCH("Bow",B3)),"Volcano",ISNUMBER(SEARCH("Scepter",B3)),"Meadow",ISNUMBER(SEARCH("Staff",B3)),"Ocean","")
The problem I had is that IF expects three arguments maximum.
Is there a way to circumvent this, possibly by breaking up the comparison using many OR statements?
You can nest IF statements. The syntax is indeed three arguments, say =IF(test,a,z). So if the first test fails you may incorporate a second for that case: =IF(test1,a,IF(test2,b,z)) and a third =IF(test1,a,IF(test2,b,IF(test3,c,z))) and so on.

Resources