I have tried so many combination, the Google sheet sometimes return the right result,, sometimes it doesn't. ( I am 100% sure using the same formula). I tried to run this formula on a brand new worksheet, but still not working.
=arrayformula(if(ISBLANK(A2),"",if(and(M2="PLANNING",N2="BUILD AHEAD"),"N",if(and(ISBLANK(J2),G2+7>today()),"Y",if(K2>G2+7,"Y","N")))))
The Google Sheet says IF statements only allow up to 3 arguments, but I think it shouldn't be.
I searched this forum, and someone mentioned that we shouldn't use "AND" or "OR" in arrayformula. I replaced "AND" with "+", but still got an error result.
Does anyone know what's the issue with my formula?
Dummy Data:
Cell: A2 = Michael, G2 = 2022-01-01, J2 = 2022-02-02, K2 = 2022-03-03.
I am trying to get a result of "Y" or "N" in Cell L2.
The expect result should be:
If G2+7 > today's date, I will get "Y" in cell L2.
If K2 < G2 + 7, I will get "N" in cell L2.
use:
=ARRAYFORMULA(IF(ISBLANK(A2:A),,
IF((M2:M="PLANNING")*(N2:N="BUILD AHEAD"), "N",
IF(ISBLANK(J2:J)*(G2:G+7>TODAY()), "Y",
IF(K2:K>G2:G+7, "Y", "N")))))
AND & OR are not supported under ARRAYFORMULA
Related
I asked this before but I can't for the life of me find that question, so I just have to assume it dissolved into the ether.
I have this SUM function =SUM(QUERY($A$1:$B, "SELECT B WHERE A = '" & "s" & "'", 0)) that works just fine when used on one sheet, but not on another sheet in the same spreadsheet. In the other spreadsheet, it returns a zero rather than the total that it's supposed to. Through some experimenting, I've found that reducing the query search range seems to fix the problem, but that is unhelpful to me as the new range is smaller than what I need. If anyone knows anything about this or any possible fixes, some help would be super appreciated!
Here is a copy of the spreadsheet in question, all cells containing the formula are highlighted yellow: https://docs.google.com/spreadsheets/d/1bNmDYdUw-FU4wWTShV1cijtOt9l7McvktgAoDELbwQ8/edit?usp=sharing
If any more info is needed feel free to ask! Thank you!
Problem is in your K Column formula. The formula returning text instead of numeric number which causing trouble QUERY() formula. Change this formula =IF((E2*F2*H2)>0, Roundup(((E2/F2)+(E2/H2))/2, 3), "-") to
=IF((E2*F2*H2)>0, Roundup(((E2/F2)+(E2/H2))/2, 3), 0)
You can directly use avg() function to query formula to get average. Try-
=QUERY($B$2:$M, "SELECT avg(K) WHERE B = 's' label avg(K) ''", 0)
use:
="Average: "&AVERAGEIF(B2:B, "s", K2:K)
This question already has an answer here:
How to use arrayformula with formulas that do not seem to support arrayformulas?
(1 answer)
Closed 4 months ago.
G'day people,
I am a long time supporter/reader but this is my first time posting on Stackoverflow so please bear with me.
Example of the Sheet I am working in
=if(E2="",,If(maxifs($E:$E,$K:$K,K2)=E2,K2,""))
I am a little stumped on converting this maxifs formula above that I am trying to convert to an arrayformula in Google Sheets. This formula checks to ensure E2 (timestamp) is not blank and then compares then looks all over the timestamp column for a newer timestamp for a distinct identifier (Column K example: '43909Ben Johns' (a CONCAT of a reference number and a client)) to see if there is a new version of that identifier. if it cannot find it, it will populate the row with the latest in column L (where the formula is situated) with the same identifier that is in Column K on the same row. If it does find a newer version it will populate with "".
I tried setting up an arrayformula however I could see that it wouldn't work as I was trying to convert it. It calculated the first row but left all other rows (about 10,000) blank and I suspect that is because it is trying to compare data on E2 and K2 with other rows in column E and K. Below is the array formula I tried:
=arrayformula(if(E2:E="",,If(maxifs(E2:E,K2:K,K2:K)=E2:E,K2:K,"")))
Any help to untangle this would be appreciated and if you need me to explain further, please let me know.
EDIT: Added Sample of Sheet https://docs.google.com/spreadsheets/d/1k1qK2BuYOwDPCtHedg7zV72JmE3_TQYu9EBwZVogQbU/
Kind Regards,
Ben
Here is a formula for you that can be placed in header cell (L1):
={
"Valid Check (Most Recent)";
ARRAYFORMULA(IF(E2:E = "",, IF(E2:E = VLOOKUP(K2:K, SORT({K2:K, E2:E}, 2, False), 2, 0), K2:K, "")))
}
Following ARRAYFORMULA is giving me an error "parameter 1 value is invalid."
=ARRAYFORMULA(IF(ISBLANK(B2:B), "", GOOGLEFINANCE(B2:B, "price")))
B column of my sheet contains the stock symbols whose value I wish to fill in my sheet. Example below
Company Name
GOOG
ADBE
MSFT
Can someone help here?
This questions seems to be a duplicate of Google finance as an argument for ArrayFormula. I have answered it with more detail. As a new user I'm only able to post an answer here, I cannot comment/flag as duplicate.
Anyway, assuming stock symbols are in range B2:B, then you put the following formula in cell C2:
=IFERROR(MAP(B2:B,LAMBDA(company,GOOGLEFINANCE(company,"price"))))
This is a new method since the introduction of LAMBDA and its helper functions in Google Sheets in August 2022.
The trick here is, as far as I understand, that MAP(LAMBDA) calculates the specified formula for each row in the input array separately (effect similar to manually expanding the formula over the whole range), whereas ARRAYFORMULA passes the whole array as an argument to the formula (GOOGLEFINANCE is special and doesn't work intuitively with such input).
LAMBDA and friends are available, so this works:
=BYROW(A2:A, LAMBDA(row, IF(row = "",, GOOGLEFINANCE(row, "price"))))
Old story:
GOOGLEFINANCE cannot be used in array formulas. You'll have to extend your formula downwards.
For example this formula should be in every cell from C2 and down:
=IF(NOT(ISBLANK($B$2:$B)), GOOGLEFINANCE($B$2:$B, "price"), "")
I'm trying to get an AVERAGEIF a few conditions are met (from another sheet: SHEET1). If the conditions aren't met, then I want a different AVERAGEIFS formula to go into effect.
Not sure how to combine these two arguments. They work fine on their own, but I want Formula 2 to work if Formula 1's conditions aren't met.
Should I be using SUMPRODUCT or nest these formulas together? Would appreciate some help combining these.
Formula 1
=AVERAGEIFS('SHEET1'!R3:R105, 'SHEET1'!A3:A105, "x", 'SHEET1'!S3:S105, "*EWS*", 'SHEET1'!D3:D105, "SAV", 'SHEET1'!Q3:Q105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3)
where range to average: R3:R105
A3:A105 = x
S3:S105 contains EWS
D3:D105 = SAV
Q3:Q105 date within past 3 years <-- reason Formula 1 fails is because this last condition is not met
.
If cell doesn’t meet Formula 1's conditions, then activate Formula 2:
.
Formula 2
=AVERAGEIFS('SHEET1'!R3:R105, 'SHEET1'!A3:A105, "x", 'SHEET1'!S3:S105, "*EWS*", 'SHEET1'!D3:D105, "SAV", 'SHEET1'!B3:B105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3)
where range to average: R3:R105
A3:A105 = x
S3:S105 contains EWS
D3:D105 = SAV
B3:B105 date within past 3 years
I tried a few things, but they ended up with errors. Is there a way to use the IFERROR function? I tried to substitute Formula 2 into value_if_error, but got another error.
So try:
=iferror(your-ave-1,iferror(your-ave2,"check"))
If it returns “check” then both your average calcs have not worked. Quotes (") now corrected- a font on the smartphone...
I have not checked your average calcs as I am using a smartphone..
EDIT
updated the formula to include the correct "
=iferror(Formula 1,iferror(Formula 2,"check"))
substituted formulas:
=iferror(AVERAGEIFS('SHEET1'!R3:R105, 'SHEET1'!A3:A105, "x", 'SHEET1'!S3:S105, "*EWS*", 'SHEET1'!D3:D105, "SAV", 'SHEET1'!Q3:Q105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3),iferror(AVERAGEIFS('SHEET1'!R3:R105, 'SHEET1'!A3:A105, "x", 'SHEET1'!S3:S105, "*EWS*", 'SHEET1'!D3:D105, "SAV", 'SHEET1'!P3:P107, "<>"), "check"))
try:
=IFERROR(ArrayFormula(IF(SHEET1!Q3:Q105 > month(today())&"/"&day(today())&"/"&year(Today())-3,
AVERAGEIFS(SHEET1!R3:R105, SHEET1!A3:A105, "x", SHEET1!S3:S105, "*EWS*", SHEET1!D3:D105, "SAV", SHEET1!Q3:Q105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3),
AVERAGEIFS(SHEET1!R3:R105, SHEET1!A3:A105, "x", SHEET1!S3:S105, "*EWS*", SHEET1!D3:D105, "SAV", SHEET1!B3:B105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3))),)
update:
=IFERROR(ArrayFormula (IF (SHEET1!Q3:Q105 > month(today())&"/"&day(today())&"/"&year(Today())-3,
AVERAGEIFS(SHEET1!R3:R105, SHEET1!A3:A105, "x",
SHEET1!S3:S105, "*EWS*",
SHEET1!D3:D105, "SAV",
SHEET1!Q3:Q105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3),
AVERAGEIFS(SHEET1!R3:R105, SHEET1!A3:A105, "x",
SHEET1!S3:S105, "*EWS*",
SHEET1!D3:D105, "SAV",
SHEET1!B3:B105, ">"&month(today())&"/"&day(today())&"/"&year(Today())-3))),)
I use three columns. "H", "O" and "I". In column "I", I have a formula every row =IF( OR( O3 = "Yes",H3 = "Yes"),"Yes","No") and then for the next row I have =IF( OR( O4 = "Yes",H4 = "Yes"),"Yes","No").
How do I copy the formula for the new rows being added to the worksheet without having to write any code behind? i.e. purely using formulas.
e.g. for arithmetic operations I can use something similar to below.
=ARRAYFORMULA(IF(E3:E,E3:E*F3:F,0))
Can I use a similar approach for here as well? if Yes, How do I exactly use it for my case?
I'm using Google Spreadsheets.
If you want to use OR in Arrayformula you'll need to use +.
Can you see if this works ?
=ArrayFormula(IF(LEN(H4:H), IF((O4:O = "Yes")+(H4:H = "Yes"),"Yes","No"),))