Convert formula to arrayformula - if-statement

How can this formula be rewritten into array formula variant?
=IF(ISBLANK(D4),"",IF(AND(D4="Long", G4<=E4), "No trade", IF(AND(D4="Short", G4>=E4), "No trade", IF(AND(I4>=E4, H4<=E4), "Target Hit", "Active"))))

here is the array formula:
=ARRAYFORMULA(IF(ISBLANK(D4:D), ,
IF((D4:D="Long") * (G4:G<=E4:E), "No trade",
IF((D4:D="Short") * (G4:G>=E4:E), "No trade",
IF((I4:I>=E4:E) * (H4:H<=E4:E), "Target Hit", "Active")))))

Related

Google Sheet Array Formula Put blank

I have this formula
=ArrayFormula(IF(LEN(C$3:F$3), H4:L4+C4:F4/$C$1, ""))
How i can modify this array formula to return Blank like in I7?
try:
=BYROW(B34:F38, LAMBDA(x, INDEX(SPLIT(TEXTJOIN(" ", 1, x), " "),,1)))

How to convert this formula from excel to M language?

I'm try convert the formula bellow to Power BI M language
=IF(AC4>TIMEVALUE("20:00:00");"After the deadline";"In the term")
I tried formula bellow but doesn't work, it return this error message "The name 'IF' wasn't recognized. Make sure it's spelled correctly.":
=IF(
TIMEVALUE([#"(Transf1-Coleta)"]) > TIMEVALUE("20:00:00"),
"After the deadline",
"In the term"
)
The column [#"(Transf1-Coleta)"] is the same value of column "AC" and "AD" is the value that want get
if you are using Measure, try this below code-
=IF(
TIMEVALUE(min(table_name[column_name])) > TIMEVALUE("20:00:00"),
"After the deadline",
"In the term"
)
In M
= Table.AddColumn(#PreviousStep, "Custom", each if DateTime.Time([Transf1-Coleta])>Time.FromText("20:00:00") then "After the Deadline" else"In the term")

Search another google spreadsheet's sheet for A1 Value of current sheet, return column A,B,C's value in rows where A1 Value is found

I'm trying to query a value located in A1 of a current google spreadsheet, on a sheet located on another spreadsheet and return the values in columns A, B & C for every row where A1's value is found.
I'm dizzy.
I tried this:
=query(importrange("https://docs.google.com/spreadsheets/d/XXXXXXXXXXXX/edit","Master Investor List!A11:AX"),"select A,B,C where R or U or X matches '"&A1&"',1)
but I get this error:
Error Unable to parse query string for Function QUERY parameter 2: PARSE_ERROR: Encountered " "R "" at line 1, column 20. Was expecting one of: "(" ... "(" ...
try:
=QUERY({IMPORTRANGE("url_here"; "Master Investor List!A11:AX")};
"select Col1,Col2,Col3
where Col18 matches '"&A1&"'
or Col21 matches '"&A1&"'
or Col24 matches '"&A1&"'"; 1)

Google Sheets RegexpReplace with computable replacers

I'm trying to replace a pattern with some string computed with other GSheets functions. For example, I want to make all the int numbers in the string ten times larger: "I want to multiply 2 numbers in this string by 10" should turn into "I want to multiply 20 numbers in this string by 100".
Assuming for short, that my string is in A1 cell, I've tried a construction
REGEXREPLACE(A1, "([0-9]+)", TEXT(10*VALUE("$1"),"###"))
But it seems REGEXREPLACE firstly computes the arguments and only after that yields regular expression rules. So it converts 3rd argument
TEXT(10*VALUE("$1"),"###") => TEXT(10*1,"###") => "10"
and then just replaces all integers in the string with 10.
It turns out, I need to substitute the group $1 BEFORE implementing outer functions in the 3rd argument. Is there any way to do such a thing?
Maybe there's another way. See if this works
=join(" ", ArrayFormula(if(isnumber(split(A1, " ")), split(A1, " ")*10, split(A1, " "))))
try:
=ARRAYFORMULA(JOIN(" ", IFERROR(SPLIT(A1, " ")*10, SPLIT(A1, " "))))
or:
=ARRAYFORMULA(JOIN(" ", IF(ISNUMBER(SPLIT(A1, " ")), SPLIT(A1, " ")*10, SPLIT(A1, " "))))

Counting words in ARRAYS with ARRAYFORMULA in Google Sheets

Counting words with Array formula for every cell won't work.
I have tried to use:
=ARRAYFORMULA(COUNTA(SPLIT(Range, " ")))
=ARRAYFORMULA(SUM(COUNTA(SPLIT(Range," "))))
Both didn't work.
I expected ARRAYFORMULA to count words for every cell in the column and put it next to it, but it counted all the text and put it in one cell instead.
Copy of the sheet (Problem in Cell D123): https://docs.google.com/spreadsheets/d/1pPbJ9k4tiLk8hVxHXRgvu6b4vxJOcgTmyFhD_g8gc_Q/edit?usp=sharing
=ARRAYFORMULA(IF(LEN(A3:A),
MMULT(IF(IFERROR(SPLIT(IF(LEN(A3:A), A3:A, ), " "))<>"", 1, 0),
ROW(INDIRECT("A1:A"&COUNTA(IFERROR(
QUERY(IF(IFERROR(SPLIT(IF(LEN(A3:A), A3:A, ), " "))<>"", 1, 0), "limit 1", 0)))))^0), ))
also could be done by just counting the spaces:
=ARRAYFORMULA(IF(LEN(A3:A), LEN(REGEXREPLACE(A3:A, "[^\s]", ))+1, ))