If statement from different sheet base on two cell - if-statement

I have a 2 sheets,Summary & Remarks and I'm trying to create a REMARKS ERROR base on summary sheet data.
Example.
In Sheet Summary if both area01 & area02 has no equivalent area code in column
E8 & E9 the REMARKS ERROR! will appear in Sheet REMARKS.
And When one of the two areas
(E8 or E9) has data, the error will not appear in REMARKS SHEET
Can someone help me, please? Please see attached Google sheet
REMARKS_SHEET

try like this:
=IF(TRIM(C9)=LEFT(D8, 4), IFNA(VLOOKUP(F8, I:J, 2, 0), ))
or arrayformula:
=ARRAYFORMULA(IF(TRIM(C9)=LEFT(D8:D, 4), IFNA(VLOOKUP(F8:F, I:J, 2, 0), ), ))
=IF((SUMMARY!C9="AREA")*
((SUMMARY!D8<>"")+(SUMMARY!D9<>""))*
((SUMMARY!E8 ="")+(SUMMARY!E9 ="")),
"ERROR: NO AREA CODE UPDATED", )

Related

Is there a way to fully align text to the top of collapsed rows in a Latex kable created with rMarkdown?

I have almost got the perfect table for a Latex report I am drafting with the kable package in rMarkdown. One thing I can't get quite right is the vertical alignment of the collapsed rows.
Using the sample code from the kableExtra documentation reproduces my problem:
collapse_rows_dt <- data.frame(C1 = c(rep("a", 10), rep("b", 5)),
C2 = c(rep("c", 7), rep("d", 3), rep("c", 2), rep("d", 3)),
C3 = 1:15,
C4 = sample(c(0,1), 15, replace = TRUE))
kbl(collapse_rows_dt, booktabs = T, align = "c") %>%
column_spec(1, bold=T) %>%
collapse_rows(columns = 1:2, latex_hline = "custom", custom_latex_hline = 1:2, valign = "top")
This almost works, so close...but the vertical alignment is not consistent across the columns. This makes it unreadable when the table runs over multiple pages.
valign= "bottom" works perfectly though.
The issue is with "booktabs = T".
With it set to "F", the vertical alignment is perfect.

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

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)

Change value of a cell depending on contents of column of another google sheet

I have a Google sheet with information on it and I am trying to automate it a bit. I need a formula which changes a cell value to Yes if there are specific strings in the column of another sheet. I have tried a couple different things using IF and importrange but it's just not working.
I have created a sample sheet to show what I am trying to do:
Test Sheet 1
Test Sheet 2
I would like column C of Sheet 1 to change to Yes if Columns 1 and 2 of both sheets match and Column C of Sheet 2 contains "Reloaded" or "Yes".
try:
=ARRAYFORMULA(IF(REGEXMATCH(VLOOKUP(A2:A&B2:B, {
IMPORTRANGE("1YMBUYC6JgQke-2YWs_VZx9zqlmOdhV8WYvhTpTVxBYM", "Sheet1!A2:A")&
IMPORTRANGE("1YMBUYC6JgQke-2YWs_VZx9zqlmOdhV8WYvhTpTVxBYM", "Sheet1!B2:B"),
IMPORTRANGE("1YMBUYC6JgQke-2YWs_VZx9zqlmOdhV8WYvhTpTVxBYM", "Sheet1!C2:C")}, 2, 0),
"Yes|Reloaded")=TRUE, "Yes", ))
UPDATE:
=ARRAYFORMULA(IFERROR(IF((D2:D="User Task")*(REGEXMATCH(VLOOKUP(B2:B, {
IMPORTRANGE("1YMBUYC6JgQke-2YWs_VZx9zqlmOdhV8WYvhTpTVxBYM", "Sheet1!B2:B"),
IMPORTRANGE("1YMBUYC6JgQke-2YWs_VZx9zqlmOdhV8WYvhTpTVxBYM", "Sheet1!C2:C")}, 2, 0),
"Yes|Reloaded")=TRUE), "Yes", )))
Here you go:
={
"Complete";
ARRAYFORMULA(
IF(
(IMPORTRANGE("1YMBUYC6JgQke-2YWs_VZx9zqlmOdhV8WYvhTpTVxBYM", "Sheet1!A2:A") = A2:A)
* (IMPORTRANGE("1YMBUYC6JgQke-2YWs_VZx9zqlmOdhV8WYvhTpTVxBYM", "Sheet1!B2:B") = B2:B)
* (REGEXMATCH(IMPORTRANGE("1YMBUYC6JgQke-2YWs_VZx9zqlmOdhV8WYvhTpTVxBYM", "Sheet1!C2:C"), "Reloaded|Yes")),
"Yes",
""
)
)
}

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)), ))

Aggregating using regex in Google Sheets

I have the following cell in my spreadsheet. It is a string that has the structure of a JSON object.
D2 = {color: white, quantity: 23, size: small}, {color: black, size: medium, Quantity: 40}
For the cell D3, I want the output to be 63, which is the total of the quantities found in D2. Moreover, the following things should be noted:
If something goes wrong, for example, if a quantity is given as a string, then D3 is simply kept empty.
Anytime D2 is updated, D3 is updated as well.
If D3 is updated manually, that result is kept instead of the formula. This will happen for rows where D2 is empty.
Is there any way to do this using Google Sheets? I tried using REGEXEXTRACT, however, it did not produce any result. Any help is greatly appreciated.
Edits:
The order of the attributes is not important. For example, the quantity can appear before or after the size.
The case is also not important.
=SUMPRODUCT(IFERROR(REGEXREPLACE(SPLIT(D22, ":"), "}.*", "")))
=SUMPRODUCT(IFERROR(REGEXREPLACE(SPLIT(SUBSTITUTE(D21, "quantity:", "♦"), "♦"), "}.*", "")))