getting google sheets to ignore the first X number of rows instead of writing empty strings to them - arrays

I have the following formula to automatically insert the date in column B if the corresponding cell in row A contains data
However there are already rows that have been filled out manually from before I decided to try automate this and I don't want to lose the data
so I have the following formula (note 5 is used here just for testing purposes. in final application there are more than 100 populated rows I am trying to skip over
=ArrayFormula(IF(ROW(B:B)=1,"Date",IF(ROW(B:B)<5,"",IF(A5:A<>"",TODAY(),""))))
however it keeps returning the following error
Error
Array result was not expanded because it would overwrite data in B2.
As far as I can tell this is because it is attempting to write an empty string to these cells. Is there a way to have it not do this and simply start from row X?
I tried to wrap the formula in an IfERROR statement but that did not work and as seen above I attempted start referencing only from cell 5 onward but tat didnt work either
=ArrayFormula(IFERROR(IF(ROW(B:B)=1,"Date",IF(ROW(B:B)<5,"",IF(A:A<>"",TODAY(),""))),""))

Related

Applying array formula for rows with existing data

I have trouble creating automation using Google Sheets. I use array formula for converting duration format from one column, to make it understandeable for Google Data Studio, however, my autiomation, when there's no existing project, needs to append a new row. But if there's an array formula applied to a column, it has created 0 values for 1000 rows, and my new row gets appended as 1001. How to fix that?
Maybe I could somehow limit the array formula to work only if there's data in the row?
I tried to find other variant of array formula from here, but none of these worked,
https://support.google.com/docs/table/25273?hl=en
I could use some help. Thanks before.
Here's my spreadsheet, that I'm working on
https://docs.google.com/spreadsheets/d/1zWxvwNhCExy7_9tvgJ0lo4nBmYac51NMqaqzh8kR4H4/edit?usp=sharing
Array formula applied to last column creates rows for non-existend data
use:
=ARRAYFORMULA(IF(E2:E="";;SECOND(E2:E)+MINUTE(E2:E)*60+HOUR(E2:E)*3600))

Dynamic Helper Column?

I wish to create a helper cell using a dynamic array, Is this possible?
Normally I use a formula such as in this example =IF(A4="",C2,A4) which check if column A is blank and if so just copies the above value until a new value appears in column A.
However as shown in the image when I insert New rows the helper cell becomes broken.
For this reason I wanted to use a dynamic array to create the helper cell which should be able to handle rows inserted or removed.
The problem I have is that unlike a normal formula which you can just drag down, a dynamic array is looking at the values as a whole. Using =IF(A4:A40="","-",A4:A40) inserts a hyphen as shown in the image. Essentially I wish to replace the hyphen such that "For each value between A4:A40 check if blank and if true take the value in the above cell". In essence creating a dynamic helper column.
You can use the inexact form of Match to find the last row which is not blank, and then Index to take the value in column A from there:
=INDEX(A4:A40,MATCH(ROW(A4:A40),IF(A4:A40<>"",ROW(A4:A40))))
This sort of thing is done a lot in Google Sheets.
If you insert a row, the formula changes to
=INDEX(A4:A41,MATCH(ROW(A4:A41),IF(A4:A41<>"",ROW(A4:A41))))
and still works OK.

Cant Get formula to enter blank cells at end of column

I have data composed on chemicals and hyphened cells in column F of sheet1.
Using the formula in sheet2: =IF('Formulation card'!F7:F60="-","",'Formulation card'!F7:F60)
This works well to convert the hyphened cells to a blank cell if present in F7:F60 of the formula card.
At at end however I get a bunch of '0's entered where Blank non hyphenated cells are present.
I've tried to use an OR Statement as follows:
=IF(OR('Formulation card'!F7:F60="-",""),"",'Formulation card'!F7:F60)
Which to me reads if a - or a "" is present return "".
However doing this just returns all columns as Blank. I though I had got my head around using OR statements but apparently not.
If someone could point out whats wrong here that would be great. Let me know if you require more information.
Internally all given indices inside an OR() statement will be processed, however only one value of FALSE or TRUE will be returned depending if any of the calculations returned TRUE. Hence why your column will stay "empty". It's actually not empty, but full of zero-width strings.
You can circumvent that behaviour in Microsoft365 using some boolean structure:
=IF(('Formulation card'!F7:F60<>"-")*('Formulation card'!F7:F60<>""),'Formulation card'!F7:F60,"")

Dynamic Array with multiple CountIfs

Is there a way how to get multiple results out of COUNTIF(S)?
I have a "compliance checklist" table of resources, where each row represents one resource. Based on the periods in columns H-J I get ✕ if person is non-compliant and ✓ if everything is OK.
Current formula for compliance calculation:
=COUNTIFS(INDEX($H$8#,(ROW(H8)-ROW($H$7)),,1),"✕")
This current formula needs to be in each line separately and I would like to change it to dynamic array formula to have only 1 formula in first row. However I have tried, it seemed to me that it is not possible, I always get !SPILL or another type of error.
I don't think what you are trying is possible in a row-wise fashion through COUNTIFS(). Btw, "SPILL" error is because a formula wants to spill data but is not able to do so since those cells are allready filled with data.
Either way, you could try MMULT() instead:
Formula in G8:
=MMULT(--(H8#="✕"),{1;1;1})
If you want to, you can make the 2nd parameter dynamic too:
=MMULT(--(H8#="✕"),SEQUENCE(COLUMNS(H8#),,1,0))

Excel - my formula needs to incorporate the last filled cell in column

I am building a calculator that detects streamflows that falls below a certain flow rate. I have an array formula that takes a column of data, and identifies how many data points in a row fall below a particular threshold (threshold value in C12):
{=MAX(FREQUENCY(IF(E23:E12275<C12,ROW(E23:E12275)),IF(1-(E23:E12275<C12),ROW(E23:E12275))))}
This formula works, but I want to be able to build in the ability to detect the last row with entered data. In this example, the data set finishes at E12275, but datasets can extend many more rows. If I extend the formula to this:
{=MAX(FREQUENCY(IF(E23:E1000000<C12,ROW(E23:E1000000)),IF(1-(E23:E1000000<C12),ROW(E23:E1000000))))}
the formula interprets the blank cells (after the last full cell) as zero, and says that they fall below the threshold. This gives me a result of 987725 (1000000-12275)
I have built another formula that detects the bottom row cell address:
=ADDRESS(LOOKUP(2,1/(E23:E1000000<>""),ROW(E23:E1000000)),5,1)
However I am having trouble incorporating this result into the existing formula. Does anyone have any thoughts on how to do this?
NB: I have also toyed with the idea of building a formula that excludes blank cells, however the actual datasets include blank cells, which should be interpreted as "below threshold"

Resources