Why isn't Importrange() data working in function? - if-statement

I've looked up every solution to this question and tried them all with no luck.
Im importing coordinates from another page and determining if they're between a range using the =if(and() function. But it seems like the and() will only accept 3 and() statements max. And some of the functions don't even register in the functions. I cant figure out why.
All cells are formatted as numbers
tried various combinations
Feel free to play with the function. I've been working on it for 3 days and still can't find a solution. Can anyone help?
https://docs.google.com/spreadsheets/d/1OZSDju3hRyGyRfFhHJT2PLQ3DBvcfOAT1ZvNxB-J0DQ/edit?usp=sharing
Take a look at the green higlighted rows. They all fall within the Green highlights range but nothing.,,

try:
=ARRAYFORMULA(IF(
IFNA(VLOOKUP(A2:A*1, SORT(QUERY(SPLIT(FLATTEN(IF(F2:G="",,F2:G&"♦"&E2:E)), "♦"),
"where Col2 is not null", 0)), 2, 1))=
IFNA(VLOOKUP(B2:B*1, SORT(QUERY(SPLIT(FLATTEN(IF(H2:I="",,H2:I&"♦"&E2:E)), "♦"),
"where Col2 is not null", 0)), 2, 1)),
IFNA(VLOOKUP(A2:A*1, SORT(QUERY(SPLIT(FLATTEN(IF(F2:G="",,F2:G&"♦"&E2:E)), "♦"),
"where Col2 is not null", 0)), 2, 1)), ))
!! however
in case of possible overlaps you will need to use this formula and drag down:
=ARRAYFORMULA(TEXTJOIN(", ", 1,
IF((A2*1>=F$2:F)*(A2*1<=G$2:G)*(B2*1>=H$2:H)*(B2*1<=I$2:I), E$2:E, )))
your importrange should be:
=ARRAYFORMULA(REGEXREPLACE(""&QUERY(
IMPORTRANGE("1ol7DTYZcwZVZk6WhfCLQ1JBt3_3QIEXEC5TkfEerCMw", "CheckinForm!I2:J30"),
"where not Col1 = '#ERROR!' and Col1 is not null", 0), "^: ", )*1)

Related

google sheets, splitting and stacking a paragraph

I have a 3 row by 2 column table
1Q18 hello. testing row one.
2Q18 There are about 7.5b people. That's alot.
3Q18 Last sentence. To be stacking.
I want to split each sentence then have a quarter label with it, out would be
1Q18 hello
1Q18 testing row one
2Q18 There are about 7.5b people
2Q18 That's alot
3Q18 Last sentence
3Q18 To be stacking
I can get one line to work with:
=TRANSPOSE({split(rept(A1&" ",counta(split(B1,".")))," ");split(B1,".")})
which would give me:
1Q18 hello
1Q18 testing row one
I need a formula that will let me go down 100 rows, so I can't manually repeat the formula 3 times and use {} with ;
I've also tried using the
=map(A1:A,B2:B,LAMBDA(x,y,TRANSPOSE({split(rept(x&" ",counta(split(y,".")))," ");split(y,".")})))
but get a
Error Result should be a single column.
try:
=INDEX(QUERY(SPLIT(FLATTEN(LAMBDA(x, IF(x="",,A1:A&"​"&x))
(SPLIT(B1:B&" ", ". ", ))), "​"), "where Col2 is not null", ))
Try below formula-
=QUERY(REDUCE(,B1:B3,LAMBDA(a,x,{a;TRANSPOSE(INDEX(INDEX(A1:A,ROW(x)) & " " & SPLIT(SUBSTITUTE(x,". ",".|"),"|")))})),"offset 1",0)
Here's another formula you can try:
=ARRAYFORMULA(
QUERY(
REDUCE({0,0},
QUERY(A1:A&"❄️"&SPLIT(B1:B,". ",),
"where Col1 <> '#VALUE!'"),
LAMBDA(a,c,
{a;SPLIT(c,"❄️",,)})),
"where Col2 is not null offset 1",))

Calculate the time spent in a room on G-sheet

I am trying to make a calculation on how to automatically see how long Paul, Jack and John spent in the room as shown on the enclosed pic. I cannot figure out if I should have an IF formula added with a VLOOK, but I am not sure and need your expertise. Please help
use in D2:
=ARRAYFORMULA(IF(C2:C="",,IF(ISODD(
COUNTIFS(C2:C, C2:C, ROW(C2:C), "<="&ROW(C2:C))), "IN", "OUT")))
use in E2:
=ARRAYFORMULA(IFNA(TEXT(VLOOKUP(A2:A&C2:C&D2:D,
{FILTER(A2:A&C2:C&D2:D, D2:D="OUT"),
QUERY(FILTER(B2:B, ISEVEN(COUNTIFS(A2:A&C2:C, A2:A&C2:C, ROW(C2:C),
"<="&ROW(C2:C)))), "where Col1 is not null")-
QUERY(FILTER(B2:B, ISODD(COUNTIFS(A2:A&C2:C, A2:A&C2:C, ROW(C2:C),
"<="&ROW(C2:C)))), "where Col1 is not null")}, 2, 0), "[h]:mm:ss")))

Returning only the values that occured more than a certain date range ago

I have a spreadsheet where Column A is the year, and column B is the shirt color used. The shirt colors are repeated.
I want to find a way to generate a list of the colors that have not been used in the last 10 years. The problem I am running into is due to the fact that the colors repeat. I tried using
=unique(filter(B2:B, A2:A<today()-(365*10)))
but shirts that were used in the last 10 years are then still included.
try:
=ARRAYFORMULA(TEXTJOIN(", ", 1, UNIQUE(IF(NOT(REGEXMATCH(B:B,
TEXTJOIN("|", 1, UNIQUE(FILTER(B:B, A:A>=YEAR(TODAY())-10))))), B:B, ))))
for dates in column A use:
=ARRAYFORMULA(TEXTJOIN(", ", 1, UNIQUE(IF(NOT(REGEXMATCH(B:B,
TEXTJOIN("|", 1, UNIQUE(FILTER(B:B, YEAR(A:A)>=YEAR(TODAY())-10))))), B:B, ))))

Reversing a column when calculating slope for a line chart in Google Sheets

I have the following sheets:
https://docs.google.com/spreadsheets/d/1aC9lsmxVw0pYN_Wjk7gooB0c7CsvmkRsEeCUBEKUIlM/edit?usp=sharing
It should be pretty obvious looking at it. There is a spark-line which becomes green if the the trend is positive. From the data, it makes intuitive sense that the line should be trending up. However, due to the way I wrote the formula, the line is instead trending down and red. How can I reverse the columns being used in the formula?
Note: The data on the right hand side should remain in the same order.
Thanks for any help.
try:
=IFERROR(ARRAYFORMULA(SPARKLINE(
QUERY({B2:B, ROW(B2:B)}, "select Col1 order by Col2 desc"),
{"charttype", "line"; "color", IF(SLOPE(
QUERY({B2:B, ROW(B2:B)}, "select Col1 order by Col2 desc"),
ROW(A2:A)-1)>=0, "lime", "red"); "linewidth", 2})))

What formula or method could I go to subtract amounts from values in a range using a table

I have a master sheet with values of what I would sell for. I want to create a formula or rules where I can subtract commission based on the value of the cell. I want to be able to edit from the table only so I don't have to mess around with hundreds of cells formulas when things change. I also don't want to just take commission by percentage. I know how to link the cells. I want a formula that will look in the table and say hey its between the two values so ill extract this amount of commission. I have attached a picture of an example of the rules table.
I've tried doing IF statements and ran into too many arguments issues.
I expect the formula to look in my table and take out the proper commission beside it.
=ARRAYFORMULA(Main!B2-VLOOKUP(Main!B2,
{REGEXEXTRACT(Comission!$A$3:$A$13, "\d+")*1, Comission!$B$3:$B$13}, 2))
you can do various things like:
=ARRAYFORMULA(IF(A9:A<>"", IF(COUNTIF(A9:A, A9:A)>1,
B9:B-(B9:B*IFERROR(VLOOKUP(B9:B,
{{REGEXEXTRACT(A3, "\d+")*1, -B3% };
{REGEXEXTRACT(A4, "\d+")*1, -B4%};
{REGEXEXTRACT(A5, "\d+")*1, -B5%};
{REGEXEXTRACT(A6, "\d+")*1, -B6%};
{400, 0}}, 2))),
B9:B-(B9:B*IFERROR(VLOOKUP(B9:B,
{{REGEXEXTRACT(C3, "\d+")*1, -D3% };
{REGEXEXTRACT(C4, "\d+")*1, -D4%};
{REGEXEXTRACT(C5, "\d+")*1, -D5%};
{REGEXEXTRACT(C6, "\d+")*1, -D6%};
{400, 0}}, 2)))), ))
assuming Ema is a reseller and Jane & Yuki are one-timers
alternatives: https://webapps.stackexchange.com/q/123729/186471
=ARRAYFORMULA(IF(A2:A<>"", IFERROR(VLOOKUP(A2:A, Main!A2:B, 2, 0))-
IFERROR(VLOOKUP(IFERROR(VLOOKUP(A2:A, Main!A2:B, 2, 0)),
{IFERROR(REGEXEXTRACT(Comission!A3:A, "\d+")*1), Comission!B3:B}, 2)), ))