Google Sheets Trouble with IF, IFS, AND & OR statements - google-sheets

I can't get the syntax correct for =ifs(and(C2="Steve",E2<>""), (or(and(D2<>""), C2="Ted", C2="Nancy, C2-"Jane""),"YES","NO")) I'm Getting a Formula Parse error.
I am trying to return a "YES" if cell E2 is not blank and cell C2 contains one of many possible text strings ("Ted", "Nancy", or "Jane").... or if cell C2 contains text string "Steve", and cell E2 is not blank.
If anything other than the above is true then I want to return a "NO".

This was resolved in a different more flexible platform... the answer is here:
=IF(AND(E2<>"",
OR(C2="Steve",
AND(D2<>"",OR(C2="Ted",C2="Nancy",C2="Jane")))),"YES","NO")

Related

GSHEET How do I Extract Text from formula for creating automatic cell reference

The context :
Each time i need a cell reference from my other sheet, I need others cell reference from the same line but from different column.
I would like to automate those adding reference values depending on the first reference i add manually.
I have a sheet named alpha and a sheet named beta
I have a cell A1 in alpha that refers to beta A1
I have this referred cell formula in alpha A1 to have the value from beta A1
=beta!A1
Objectif :
I would like to have in alpha B2 the cell automatically filled-in by the value from beta A7
the equivalence of this refered cell formula
=beta!A7
Because the number seven will never change, only the column can change it could be:
=beta!AC1
so I will need =beta!AC7 automatically populated.
The Goal :
The goal is to extract from the formula in alpha A1 all characters except number(s) by a formula (like SEARCH, LEN, from FORMULATEXT) to obtain
=beta!A
with this result, I will concatenate with a cell that has the value "7". to obtain the formula for the cell reference.
A
B
C
1
=beta!A1
=beta!A7
7
2
=beta!AC1
=beta!AC7
If anyone can give me this formula clue or a better way to reach my goal would be good
I tried the regex below but it removed the punctuation
=REGEXREPLACE(FORMULATEXT(A1),"[^[:alpha:]]", "")&C1 where C1 is the value "7"
But i have all the need without the exclamation mark "!"
=betaA7
instead of
=beta!A7
Thank you
this is what you want
Use this to REGEXEXTRACT all the numbers and REGEXREPLACE then with "" nothing. and add &$C1 the value in C1.
=REGEXREPLACE(A1, REGEXEXTRACT(A1, "[0-9]+"), "")&$C1
A better way
See in Beta!A1 we have a value of Im beta A1
And in Beta!A7 we have a value of Im beta A7
And in alpha!A1 we hane the formula =beta!A1
To get the value of beta!A7 using the formula in alpha!A1 as an input we use this formula in beta!B1
=INDIRECT(REGEXREPLACE(SUBSTITUTE(FORMULATEXT(A1),"=",""), REGEXEXTRACT(SUBSTITUTE(FORMULATEXT(A1),"=",""), "[0-9]+"), "")&$C1)
Explanation
INDIRECT(=beta!A1)
Even more simpler approach
Use this formula directly
=OFFSET(beta!A1,C1-1,0)

Using a concatenated string in Google sheets query WHERE condition

I am trying to use the result of a concatenation of a string and cell contents in a query, but the query function does not seem to like it: see this example
https://docs.google.com/spreadsheets/d/1CtPFLhpD3KDHrk-6WoHft4JdMTVa3OcvHHqAidMWwdM/edit?usp=sharing
The strings in cells B2 and B3 appear to be the same, but whilst C3 gives the desired result, C2 does not. B3 simply extracts a string from A3, whereas B2 tags the 'E' on in the formula. The data in the real spreadsheet I am working with is like that in B2, so I have to add the 'E' into the result. The real list of error codes is quite long and varied, so I cannot edit that to just use the number. I also tried using CONCATENATE, but that made no difference.
How do I get the query to recognise the contents of C2 as the string 'E151'?
Most likely there's an trailing space in the result of B2.
See if this helps
=query(A7:B10,"select B where A = '"&trim(B2)&"'",0)
In B2
="E"&mid(A2,30,3)
or
="E"&index(REGEXEXTRACT(A2,REGEXREPLACE(A2,"(\d+)","($1)")),1,5)
(the 5th number in the string)
delete everything in column C and use this in C2:
=INDEX(IFNA(VLOOKUP(TRIM(B2:B4), A7:B11, 2, 0)))
Some great answers to my question, thanks! It was a trailing space causing the problem.
I have combined some of the ideas in the other answers in the real spreadsheet and used
="E" & trim(mid(A2,30,3))
Since some of the error codes are only 2 characters long

On cell referencing in google sheets, clarification needed

On sheet Summary, I have a cell A1 that has a value "AAPL"
On sheet AAPL, I have a cell X22 that has a value "123"
In order for me to display "123", I do =AAPL!X22. Pretty straightforward.
How can I rewrite this using A1 value? In other words instead of hardcoding AAPL, I would like to express .. whatever is in A1 cell
I tried
=&A1!X22 but this didn't work.
Thank you for your time
Use INDIRECT. Enclose the !X22 in quotes and do not put quotes around the reference to the cell containing AAPL (in your question A1, or in the comments D30):
=INDIRECT(D30&"!X22")

reference a range that is in a cell

I know this answer is out there, I am just not using the write words to ask.
In cell B1 I have "Form Responses 1'!$C:$C" written out.
In cell B3 I have a countif formula that I would like to use the contents of cell B1 as the range. So something like the below
=COUNTIF(B1,"Option 1"), or I have tried =COUNTIF(Indirect(B1),"Option 1")
Both don't see the the contents of B1 as a range, and therefore it is not giving me a count of the items in the range.
Try this without B cells:
=COUNTIF('Form Responses 1'!C:C,"Option 1")
Thanks to Abdul Hameed, I came up with two solutions.
Cell B1 = "C"
my countif formula is: =COUNTIF(INDIRECT("'Form Responses 1'!$"&B1&":$"&B1),"Option 1")
or to directly answer my first question
Cell B1 = Form Responses 1!$C:$C (no double or single quotes)
=COUNTIF(INDIRECT(B1),"Option 1")

If A1 Equals B1 condition

Cell A1 = "YES"
Cell B1 = "YES"
Is it possible to write a formula that makes Cell C1 EQUAL TRUE if Cell A1 MATCHES Cell B1?
It's a super simple thing I'm trying to do, but I can't find anything useful in the Google Sheets documentation. I know this is possible in MS Excel.
you can actually just put =eq(A1,B1) and the default values are true or false.
Or if you prefer a different response you can make it an if statement and choose your own text i.e.
=if(eq(A1,B1),"Yes","No")
Answered my own question:
=ArrayFormula(IF(EQ(A1, B1), TRUE, FALSE) )

Resources