arrayformula with ifs, isblank and AND/OR in google sheets - 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,"")

Related

Highlight duplicates within cells

Help needed finding duplicate words with single text cells in google sheets?
Data has trim function applied.
e.g =if(B10"",""trim(concatenate($I$3," ",trim(B10)," ",$J$3)))
Tested solution needs some modifications
Requirement number of duplicates in one cell in not important, it can be any word, in any position, it has to match exact word and duplicates should not be removed.
For example, in a cell: "Great Great Expectations" formula should detect “Great” repeated twice, and where no duplicate words are found no change should happen
Desired outcome would be to highlight entries with duplicate entries in column "I" or create message box listing duplicate entries.
Tested solutions include vlookup and array formula as standalone "dupe" "no dupe" comparison.
Only Solution that provide any success was
=IF(SUM(N(IFERROR(FIND(" "&MID(A2,ROW(OFFSET(A$1,,,LEN(A2))), MMULT(FIND(" ", {""," "} &A2&" ",ROW(OFFSET(A$1,,,LEN(A2)))),{1;-1}))&" ", " "&A2&" "), LEN(A2)+1)<ROW(OFFSET(A$1,,,LEN(A2)))))>0, "Dupes", "All good")
This return consistently correct result for standalone data, but I have not sure how to modify this to.
Run automatically
Highlight Cells with Duplicates
Open to any solutions
Thanks in advance
#Harun24Hr
Array Formula Returns "1" for blank lines
and Ref range error for any other cell.
Conditional Formatting is applying Colour formatting to entire range, with data no longervisible.
Any ideas
Thanks
Try below formula. When you will apply formula to conditional formatting then it will apply to all cells automatically for selected range.
=ArrayFormula(INDEX(SORT(COUNTIFS(TRANSPOSE(SPLIT(A1," ")),UNIQUE(TRANSPOSE(SPLIT(A1," ")))),1,FALSE),1)>1)
Conditional formatting settings.

Unique QUERY based on IFS, AND formula in Google Sheets

I have 4 different queries that pull different columns of data.
I would like to create an IFS, AND formula on some checkboxes. Based on what checkbox is clicked, I would like it to execute the specific query.
I am getting the error:
IFS has mismatched range sizes. Expected row count: 1. column count: 1. Actual row count: 20, column count: 2.
Here is a working example of my formula (IFS, AND, without QUERY)
=IFS(
AND(E3=TRUE,F3=TRUE),"Both boxes are checked. (TRUE/TRUE)",
AND(E3=FALSE,F3=FALSE),"Both boxes are unchecked. (FALSE/FALSE)",
AND(E3=TRUE,F3=FALSE),"First box is checked. (TRUE/FALSE)",
AND(E3=FALSE,F3=TRUE),"Second box is checked. (FALSE/TRUE)"
)
Here is the non-working version of my formula (IFS, AND, with QUERY)
=IFS(
AND(E3=TRUE,F3=TRUE),QUERY(J1:K),
AND(E3=FALSE,F3=FALSE),QUERY(L1:M),
AND(E3=TRUE,F3=FALSE),QUERY(N1:O),
AND(E3=FALSE,F3=TRUE),QUERY(P1:Q)
)
Why is this formula breaking when I introduce query?
Click Here - to view my Google Sheet.
IFS within an ArrayFormula does not behave as nested IFs do in an ArrayFormula
You will have to use nested IFs for your formula.
Try the following
=ArrayFormula(IF(AND(E3=true,F3=true),J3:K,
IF(AND(E3=FALSE,F3=FALSE),L3:M,
IF(AND(E3=true,F3=FALSE),N3:O,
IF(AND(E3=FALSE,F3=true),P3:Q)))))
You also notice that the QUERY function is not needed because you do not actually use it.

How to highlight PARTIAL matching duplicates across 1 column in Google Sheets using conditional formatting

As the title says, I'm trying to highlight partial duplicates for 1 column in Google Sheets using conditional formatting.
Here's what I have so far:
=if(C1<>"",Countif(C$1:C,left(C1,5)& "*") > 1)
This works, but the issue is the "left" makes it so the code only highlight cells that are duplicates from the start.
So for instance, the formula won't highlight "1exampletest" and "2exampletest" because the first 5 characters are not the same...which is something I want the formula to be able to highlight.
Does anyone know the right formula for detecting partial duplicates regardless of when the duplicate is occurring?
there are several ways how to do it which may or may not work for you (because you did not provide a geniue sample)
_______________________________________________________________
or with REGEXMATCH like: =REGEXMATCH(A1, "example")
_______________________________________________________________
=OR(IF(C1<>"",COUNTIF(C$1:C,LEFT(C1,5)&"*")>1),IF(C1<>"",COUNTIF(C$1:C,"*"&RIGHT(C1,5))>1))

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.

Make countif ignore "- -" from continue

I'm having trouble with a countif that I am using to count the number of entries in a range. The problem is that the range is populated with an array formula, and when the data changes the cells the array formula added a =CONTINUE(...) to now display -- (minus minus)
=COUNTIF(C6:C, "<>")
Is there a way that the countif could be written to ignore cells with --?
The -- is a way that Google Sheets displays the #VALUE! error. So you can use the IFERROR function to "mask" any of these errors:
=ArrayFormula(COUNTIF(IFERROR(C6:C);"<>"))
or more simply:
=ArrayFormula(COUNTA(IFERROR(C6:C)))
Updated:
Why don't you filter out all cells that are not text or similar to --?
Then use filtered range for countif.
=COUNTIF((ROWS(C6:C)-COUNTIF(C6:C"<>*")) , "ur criteria")
Is there a way your formula array could cast a string other than --?
Check this article
The search you are doing has regular expression.
Writing this on mobile. So please try out and pardon for weird formatting.

Resources