Google Sheet formula error when added further condition - google-sheets

Trying to add a condition in the following formula that IF(F3:F<DATE(2020,6,30),13 whenever i tried to add it gives me an error.
Your help will be highly appreciated
=ArrayFormula(if(len(G3:G),ROUND(IF(LEN(F3:F),IF(G3:G="Confirmed",13 - MONTH(DATEVALUE(TEXT(F3:F,"mmm")&" 1"))) * 13/12,IF(G3:G="Probation",0)))),""))
I broken the formula and make it work for me but how to do the same thing with above one
=IF(AND(F3:F<DATE(2020,6,30),G3:G="Confirmed"),13,(13 - MONTH(DATEVALUE(TEXT(F3:F,"mmm")&" 1"))) * 13/12
)
Sheet link
https://docs.google.com/spreadsheets/d/1IGSRMfqDODklJdPS4_TIMlIZJSM2JXqf_4pWOGjav4I/edit#gid=0

Issues
1.) You placed your "Probation" condition outside an IF statement does generating the error of "Wrong number of arguments..."
2.) AND formula cannot be used inside an ARRAYFORMULA because it will end the whole array together which will generate unexpected result.
Solution
1.) You can place your "Probation" condition before the "Confirmed"&DATE condition right after the IF(LEN(F3:F)..
2.) Instead of using AND. You can multiply both conditions which will return 1 if both conditions are TRUE.
You can use the formula below. This is working as expected on my end:
=ArrayFormula(if(len(G3:G),ROUND(IF(LEN(F3:F),IF(G3:G="Probation",0,IF(F3:F<DATE(2020,6,30)*(G3:G="Confirmed"),13,(13 - MONTH(DATEVALUE(TEXT(F3:F,"mmm")&" 1"))) * 13/12))),"")))

Related

Check if data that satisfies multiple criteria exists in both sheet 1 and sheet 2

My table contains 2 sheets with a different number of columns. I want to add a column that will display true or false (or any other 2 opposite values ) for each row depending on whether this row satisfies 2 criteria which are: sheet1!col1=sheet2!col1 and sheet1!col2=sheet2!col2.
You'll find an illustration below.
I've tried using
ARRAYFORMULA(VLOOKUP(A1&B1, {Sheet1!A1:A4&Sheet1!B1:B4,Sheet1!C1}, 3))
but I get an error message
vlookup evaluates to an out of bound range
So I wanted to try
QUERY({Sheet1!A1:B4,A1:B5}, "Select C where ")
but I couldn't figure out how to write the condition where (sheet1)col1=(sheet2)col1 & (sheet1)col2=(sheet2)col2 and I also don't know if I can work with tables of different dimensions. I finally tried
=MATCH(A1&B1,{Sheet1!A1:A&Sheet1!B1:B})
but it always returns 1.
Any idea please?
Sheet 1
Sheet 2
Your first formula is almost right. You are getting the error message because there is only one column in the curly brackets so you have to change it to
=ArrayFormula(vlookup(A1&B1,{Sheet2!A:A&Sheet2!B:B},1,false))
and add the 'false' to make sure it only does exact matches.
To make the query work you need the right syntax to access cells in the current sheet:
=query(Sheet2!A:B," select A,B where A='"&A1&"' and B='"&B1&"'")
To make the match work, you need to enter it as an array formula and add a zero to specify exact match:
=ArrayFormula(MATCH(A1&B1,{Sheet2!A:A&Sheet2!B:B},0))
However I would take flak from my colleagues if I didn't point out that there is an issue with the vlookup and match as shown above - toto&moto would match with not just toto&moto, but also with tot&omoto etc. The way round this is to add a separator character e.g.
=ArrayFormula(vlookup(A1&"|"&B1,{Sheet2!A:A&"|"&Sheet2!B:B},1,false))
=ArrayFormula(MATCH(A1&"|"&B1,{Sheet2!A:A&"|"&Sheet2!B:B},0))
These still need some tidying up if they are to report Yes and No, and also not to give false positive on blank rows - also the vlookup and match can be written as self-expanding array formulas - but that is the short answer to the question.

Google Sheets, need to edit a column based on two columns on a second sheet

Good morning!
I've been searching high and low for how to do this, and while I feel like I get close I can't get anything more than 'invalid formula' from the conditional formatting in google sheets. So here's what I'm trying to do;
Column C on sheet 1 (Working List) needs to have a red background if the following conditions are met;
Column 'P' on sheet 2 (Complete) has the 'Address Changed' option in the drop down box (its the first one on the drop down, I've been struggling to figure out if it needs to be a '0' given its position in the list or if its 'Address Changed')
Column 'C' on sheet 2 has the same account numbers in Column 'C' on sheet 1.
I can set it up to find duplicate accounts, but I can't seem to figure out how to get the first rule for the drop down box to work. Advice?
Attempts thus far, none of them worked, all were tried separately and not in conjunction with each other. Google just says 'invalid formula' and won't save it or do anything with it.
=and(EQ(Complete!$O, "Address Changed"), EQ('Working List'!$C, Complete!$C))
=match($C2, indirect("Complete!$C:$C"), 0)
=if(EQ, indirect("Complete!$O, "Address Changed""), EQ('Working List'!$C, "Completed!$C"))
=and(indirect("Complete!$O:$O,$O="Address Changed""))
so I've tried to figure out a better way to get it working, and this is what I think might be closer to the answer.
=and(if($O:$O,indirect("Complete!$O:$O),0)),[match($C2,indirect("Complete!$C:$C"),0)]
***Friend helped me solve this. The following worked for what I needed....
=index(indirect("Sheet2!O:O"), match(C1, indirect("Sheet2!C:C"), 0)) = "Address Changed"
Take a look at this sheet with some foo data I built based on your sheet.
https://docs.google.com/spreadsheets/d/1RcM5WX3KWgWq-WWuPgyF-PZe3RP99qWF-IRpSr35Zik/edit?usp=sharing
I used some helper column, as you see.
if sheet2!P1 is changed to "Address Changed" K1 will have value of 1. This is a simple IF function.
if sheet2!C = sheet1!C, L will change to 1. This is another simple ARRAYFORMULA(IF())
Finally, column C will be formatted with the data from K1 and L by this formula
: =AND(L2=1, $K$2=1)
You can then hide the helper column / cell.
If you don't want to use helper column, look at the formula in column D :
=AND(INDIRECT("Sheet2!C2:C") = C2:C, INDIRECT("Sheet2!P1")="Address Changed")
This will serve your purpose.
You cannot refer to another sheet directly in conditional format formula, hence if you don't want to use helper column, you will have to use INDIRECT. This is also the reason why your formula failed in the first place.
I personally wouldn't recommend you to use INDIRECT though...

How to make a relative reference in an array formula in Google Sheets

Here's the straightforward version of my question:
I want to change the following formula to an array formula...
Original formula (from cell J2):
=if(F4="VM:",G4,J1)
My attempt at converting to an array formula (in cell K1):
=arrayformula(if(row(A:A)=1,G3,if(F:F = "VM:",G:G,indirect("K"&row(A:A)-1))))
This works on rows where F = "VM:", but returns a #REF error on other rows. Function INDIRECT parameter 1 value is 'K0'. It is not a valid cell/range reference.
Thoughts on how to fix this?
The more complex version of my question. i.e. Why am I trying to do this?...
I have a weird spreadsheet with data that should really be in a Wiki.
I want to create filter views for each person so they can easily filter on only their own vendors. The original formula will work, but as more vendors are added, I'd like for the formula to automatically work for those rows as well.
If there's a better way to do this, I'm listening.
I don't exactly understand your needs, but If you want to autopopulate your formula, then you only need this code in desire column in row 4 (you can change this to any other - this will autofill down from this point):
=ArrayFormula(if(F4:F="VM:",G4:G,J1:J))
Is this what you are trying to get?
After clarification:
You need this code in J2 only:
=ArrayFormula(VLOOKUP(ROW(J2:J),
QUERY({F:G,ROW(G:G)},"select Col3,Col2 where Col1='VM:'",1)
,2,1)
)
Works for you?
maybe you just need to hide errors?
=IFERROR(ARRAYFORMULA(IF(ROW(A:A)=1,G3,IF(F:F = "VM:",G:G,INDIRECT("K"&ROW(A:A)-1)))),)

arrayformula with ifs, isblank and AND/OR in google sheets

What I am trying to achieve is a formula that checks the top row for "all are blank" or "all are not blank" in specified ranges. Depending on the conditions the cell with the formula gives back 1 of 3 words or leaves it blank.
I further illustrate this with the colours in the following images
The formula I have so far:
=ArrayFormula(ifs((not(isblank(A1:B1*C1:E1*G1:I1))*(isblank(J1:L1*N1:P1))),"SEND",
not(isblank(A1:B1*J1:L1*N1:P1))*isblank(C1:E1*G1:I1),"RECEIVE",
not(isblank(A1:B1*C1:E1*G1:I1*J1:L1*N1:P1)),"TRANSFER",
ISBLANK(A1:B1+C1:E1+G1:I1+J1:L1+N1:P1),""))
I don't understand what is wrong with the formula. As for example in the case when J1:L1*N1:P1 are filled, isblank(J1:L1*N1:P1) returns false when i want that to be true.
Here are the individual IF statements:
=IF((COUNTIF(A1:E1,"?*")=5)*(COUNTIF(G1:L1,"?*")=6)*(COUNTIF(N1:P1,"?*")=3)=TRUE,"TRANSFER","")
=IF((COUNTIF(A1:E1,"<>")=5)*(COUNTIF(G1:I1,"<>")=3)*(COUNTIF(J1:L1,"")=3)*COUNTIF(N1:P1,"")=3,"SEND","")
=IF((COUNTIF(C1:E1,"")=3)*(COUNTIF(G1:I1,"")=3)*(COUNTIF(J1:L1,"<>")=3)*COUNTIF(N1:P1,"<>")=3,"RECEIVE","")
Here are the nested IF statements.
=IF((COUNTIF(A1:E1,"?*")=5)*(COUNTIF(G1:L1,"?*")=6)*(COUNTIF(N1:P1,"?*")=3)=TRUE,"TRANSFER",IF((COUNTIF(A1:E1,"<>")=5)*(COUNTIF(G1:I1,"<>")=3)*(COUNTIF(J1:L1,"")=3)*COUNTIF(N1:P1,"")=3,"SEND",IF((COUNTIF(C1:E1,"")=3)*(COUNTIF(G1:I1,"")=3)*(COUNTIF(J1:L1,"<>")=3)*COUNTIF(N1:P1,"<>")=3,"RECEIVE","")))
So with the help of Nate I came up with the following formula:
=IFS(ISODD((COUNTBLANK(A1:E1)=0)*(COUNTBLANK(G1:L1)=0)*(COUNTBLANK(N1:P1)=0)),"TRANSFER", (ISODD((COUNTIF(A1:E1,"<>")=5)*(COUNTIF(G1:I1,"<>")=3)*(COUNTIF(J1:L1,"")=3)*COUNTIF(N1:P1,"")=3)),"SEND",ISODD((COUNTIF(C1:E1,"")=3)*(COUNTIF(G1:I1,"")=3)*(COUNTIF(J1:L1,"<>")=3)*(COUNTIF(N1:P1,"<>")=3)),"RECEIVE",true,"")

LOOKUP in Google spreadsheet oddly applied to row

I can't make lookup working properly when used in rows. Where am I wrong ?
See my attempt in the following image
Why are you using LOOKUP? It's very limited in its capability.
To answer your question; it's not working because the LOOKUP requires that the search range is in ascending order, i.e. A - Z in your lookup range you go from a - z - e and this is why it's not working.
You should use the HLOOKUP instead, try this formula instead: =HLOOKUP(D2,$A$2:$C$3,2,0)
Try this:
=HLOOKUP(D3,$A$2:$C$3,2,0)

Resources