I am trying to get this Arrayformula to work [duplicate] - if-statement

This question already has answers here:
Perform calculation only if both cells are not blank with arrayformula? [duplicate]
(3 answers)
ArrayFormula and "AND" Formula in Google Sheets
(4 answers)
Closed 4 months ago.
So I am trying to get this Arrayformula to work so I can plot this formula instead of calculating every Y myself.
=arrayformula(Sum(IF(Z3:Z294>Y$1;IFS(AB3:AB294>0;0;Z3:Z294>Y$1;Y3:Y294-(F3:F294*Y$1));0)-(Sum(IF(and(J3:J294>0;Z3:Z294>Y$1);F3:F294;0)))))
It gives me the (correct) return of this part:
Sum(IF(Z3:Z294>Y$1;IFS(AB3:AB294>0;0;Z3:Z294>Y$1;Y3:Y294-(F3:F294*Y$1));0)
But it doesn't subtract the second part:
-(Sum(IF(and(J3:J294>0;Z3:Z294>Y$1);F3:F294;0)))))
I am quite new to extensive Excel/Sheets formulas so I have no idea how to get this to work, It is also quite weird that the second part doesn't add up even seperate from the first part. So this also doesn't work:
=arrayformula(Sum(IF(and(J3:J294>0;Z3:Z294>Y$1);F3:F294;0)))
I hope it makes some sense without any context, thanks in advance!
Have a great rest of your day,
P.S. Please ignore simple mistakes, I don't code that often in Sheets ;)

AND is not supported. instead of
and(J3:J294>0;Z3:Z294>Y$1)
do this:
(J3:J294>0)*(Z3:Z294>Y$1)

Related

Getting an formula parse error on a basic if statement [duplicate]

This question already has an answer here:
I get Formula parse error with all formulas
(1 answer)
Closed 4 months ago.
I am trying to use IF statement in a Google Sheet, but whatever I am typing in the IF I am always getting a formula parse error. Do I have to activate something, or am I missing something ?
A1 & B1 have the same type (integer)
I have no idea why.
Thanks in advance
instead of , use ; - this should solve your issue asap

Trying to separate the year month and day fields via RegEx [duplicate]

This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 4 years ago.
I have a series of dates that I am trying to separate into years, months and days. These dates are in the yyyy-mm-dd format. I'm not very familiar with RegEx, but I have tried (\dddd)\-(\dd)\-(\dd).
Any help is appreciated.
Accepted answer would also match invalid dates like 1234-56-78, or if mm & dd were in the wrong positions.
([1-2][0-9]{3})\-([0-1][0-9])\-([0-3][0-9])
Does a little more validation.

Increase print depth for lists in SML/NJ [duplicate]

This question already has an answer here:
Increasing the print depth in SML/NJ
(1 answer)
Closed 6 years ago.
I'm using Emacs to write a simple function in sml of about 4 lines and when I try to call the function/evaluate it in the buffer it returns this with 3 dots at the end
val it = [1,2,2,2,2,2,2,2,2,2,2,2,...] : int list
What's the dots at the end? My code doesn't print any dots. Is this is from Emacs or sml? any hints please.
Also I'm supposed to get a longer list like
[1,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2,2]
is that why the dots there?
is that why the dots there?
Yes.

gsub returns matrix of numbers instead of replacing string [duplicate]

This question already has answers here:
Replacing the specific values in columns of data frame using gsub in R
(2 answers)
Closed 6 years ago.
I'm trying to use R for the first time and want to do something that seems fairly simple without much success.
I have the following Data Frame
I'am trying to keep only the date in the column Review.LastUpdate.Date.Time using :
gsub("T[0-9]{2}\:[0-9]{2}\:[0-9]{2}Z", "", DataFrameName)
I'm pretty sure it should work but the data frame remains unchanged and the console gets filled with what looks like a matrix full of numbers... (sorry I can't describe it more precisely, I have no idea what this is). It looks like something like this :
[1] "c(1,1,1,1,1, \n, 1,1,1,1,1,\n)"
If we need to extract the 'Date' part from the second column of the dataset ('df1')
as.Date(df1[[2]])
NOTE: It is better not to use regex on DateTime objects
To target the 8th column :
gsub("T[0-9]{2}:[0-9]{2}:[0-9]{2}Z","",DataFrameName[[8]])
The gsub function just returns the values extracted. They need to be assigned to the column of "DataFrameName" :
DataFrameName$Review.Last.Update.Date.and.Time <- gsub("T[0-9]{2}:[0-9]{2}:[0-9]{2}Z","",DataFrameName[[8]])

Need help trying to undo a VIM mistake [duplicate]

This question already has answers here:
How do you make Vim unhighlight what you searched for? [duplicate]
(14 answers)
Closed 6 years ago.
So I'm practicing Ruby on Codeacademy and to save the work that I'm doing I copied and pasted my code onto my cmd prompt using VIM. However, I noticed that each line of code was commented with the '#' symbol and I wanted to remove them.
To be productive, I searched online how to use regex to search for all the hashtags and remove them with this command:
:%s/#//gc
Then this popped up:
replace with (y/n/a/q/l/^E/^Y)?
I pressed y every time until the message disappeared and now I'm stuck with all hashtags characters being replaced with a yellow rectangle. So instead of having this:
#
I have this:
[] but shaded in yellow for every time I use a hastag.
Any help would be much appreciated!
The yellow rectangle represents the characters that matched your expression. To clear the last search highlighting, use:
:noh
To uncomment the lines of code, I would just do this:
Use V to select each line, then
:norm x