In Google Sheets how to reference infinite columns in all rows? - if-statement

The issue of how to reference infinite rows is already answered, but how about referencing infinite columns?
For example Sheet1 has data with an indeterminate number of rows and columns, Sheet2 I have this formula
=arrayformula(if(Sheet1!A:Z="","blank","not blank"))
It goes infinitely down... but what if I want Sheet1!A:InfiniteColumns
This is the best I could come up with
=arrayformula(if(indirect("sheet1!R1C1:"&"R"&rows(Sheet1!A:A)&"C"&COLUMNS(Sheet1!1:1),false)="","blank","not blank"))
So my question is, is there a shorter and simpler way to accomplish this?

try:
=ARRAYFORMULA(IF(INDIRECT("Sheet1!A1:"&ROWS(Sheet1!A:A))="", "blank", "not blank"))

May be this sample will get all columns from row 1 to row 1:
=arrayformula(if(Sheet1!A1:1="","blank","not blank"))
So for infinite columns we can take all columns from row 1 to last row:
=arrayformula(if({indirect("MainSheet!1:" & rows(MainSheet!A:A))}="","blank","not blank"))

Related

Power BI: shifting a column one row above

I have a case that I want find the duration for each "state_id", by subtracting its change_time from the time just below it.
So I want to generate a new column that duplicates the column "change_time" and shifting all values one row up, so the change_time #2(in red) would come next to change_time #3(in red).
Is there a way to shift that column one row up?
After a lot of thinking and researching. I have solved it with the following steps:
Sort you columns of interest from A-Z (in my case sort: ticket_id, then history_type_id, then stat_id)
make a first new index column starting from 0 using "Index column from 0".
make a second new index column starting from 1 using "Index column from 1".
merge your query with itself using "merge query" based in the two new indices.
expand the merged query for the date column only.
Now you will have a new date column, duplicated from the old one with a shift of one row.
2)

Count How Many In Column A are also in Column B

I'm trying to create a formula to count how many cells in a first column are also in a second column. It's 2 lists from the same source of unique id's, fitting 2 different criteria, and I want to count how many fit both criteria. Any help is appreciated.
try like this:
=ARRAYFORMULA(SUM(N(REGEXMATCH(B1:B, TEXTJOIN("|", 1, A1:A)))))

array formula and regexmatch won't follow through whole column

I am having an issue with an Array Formula where my current formula is:
=ArrayFormula(if(REGEXMATCH(B2,to_text('Order Form 1'!A2:A))=true,"Approved",A2:A))
I am:
1. matching the responseTimestamp (text) to the whole column of Orders received.
2. if it matches then show "Approved",
3. else, it should populate the Order not matched into that cell.
It populates in the "Pending" column correctly if it (regex)matches "B2";
however, I have more data in that column and would like it to perform this formula over "B2:B".
When I do this it doesn't populate the correct answer.
Can anyone offer insights or a solution?
Here is a link to a copy of my workbook: https://docs.google.com/spreadsheets/d/1utgP82XMkb8cOhKX2_taGqfluq6jHLNkOqUVJ31WHBM/edit?usp=sharing
Thank you in advance!
See if this works
=ArrayFormula(if(REGEXMATCH(B2:B,TEXTJOIN("|", 1, 'Order Form 1'!A2:A)),"Approved",A2:A))
Or, if you just want to list the values from A that don't match in B, try
=filter(A2:A6, isna(match(A2:A6, B2:B6,0)))
=filter(A2:A6, isna(match(A2:A6, B2:B6,0)))
Thank you JPV, your answer worked best for how my columns are arranged.

Sum values in one column of all rows which match one or more of multiple criteria

I have some table data in which I'd like to sum all the values in a specific column of all rows where column A contains string A and/or column B contains string B. How can I achieve this?
This works for one criterium:
=SUM(FILTER(G:G,REGEXMATCH(F:F,"stringA")))
I tried this, but it didn't work:
=SUM(FILTER(G:G,OR(ISTEXT(REGEXMATCH(F:F,"stringA")),ISTEXT(REGEXMATCH(C:C,"stringB")))))
Please try:
=SUM(FILTER(G:G,REGEXMATCH(F:F,"stringA")+REGEXMATCH(C:C,"stringB")))
+ works for or logic. ISTEXT is not needed because REGEXMATCH gives true or false.
OR does not work because filter is an arrayformula, use + in array formulas.
=SUM(FILTER(G:G,REGEXMATCH(F:F&C:C,"stringA|stringB")))
OR is denoted by |
EDIT Added &C:C to denote different Columns

Highlight row when two cells match

I have a sheet where on column "F" I enter the number of items purchased and on column "I" the number of items sold.The actual data starts at row 4. I want to change the color of the rows when the number of sold items matches the number of purchased items. I was able to do that with conditional formatting and the formula : =$F4=$I4 . This works ok but my problem now is that all the empty rows change color since there is no data in either of the columns and so they match. I tried filling out the sold items column with 0 but it didn't work. Any ideas ? Thanks.
I used this and it works :
=AND($F4>0,($I4+$J4+$K4)=$F4)
This way the row will get highlighted when the sum of I+J+K = F but only if there is a value bigger than 0 in F.