Google Sheets - ArrayFormula - XLOOKUP - google-sheets

so I have this situation:
I have dates (mmm-yy) in one row (horizontal) and other dates in one column (vertical) I'm trying to match them and if the dates match, then ArrayFormula-XLOOKUP but since the result cell may overwrite the next cell with formula, I've got Circular dependency detected.enter image description here
Please check attached image, I need some advice on how to workaround this issue.
I've tried arrayformula with xlookup, also possible with filter but don't know how to avoid circular dependency.

The reference F2:F points to column F, starting in cell F2 and extending all the way to the bottom, while you apparently want to point to row 2 starting in cell F2 and extending all the way to the last column.
To fix that, replace F2:F with F2:2.

Related

SUMIF sum value in next column over

I'm trying to make use of the SUMIF function in Google sheets to sum up points if a cell below it is set to "Excused" However, the condition cell (what will be "Excused") and the points cell, are not in the same column.
The basic SUMIF formula I'm starting with is below
=SUMIF($B$9:$CW$9,$B12:$CW12,"=Excused")
I've tried to illustrate this below. Using ranges that go horizontally across the sheet in rows 9 and 12. If the red cell is set to "Excused", it should sum the blue cell.
With how the formula is, it tries to sum the cell in row 9 but in the same column as the cell with "Excused" in it. But, for example, if B12 has "Excused" in it, I want it to sum C9.
Hopefully, this makes sense. I've done my best to explain it, please ask for clarification if needed.
try:
=SUM(IFNA(FILTER(C9:CX9; B12:CW12="Excused")))

How to reference an adjacent cell in google sheets relative to the selected cell

I am trying to use the =sum() function in google sheets, and so far, that's all I have typed into the targeted cell. For example, I want D3 to be the sum of C2 and D2. I know how to type that. =sum(C2,D2). But I want cells D3 thru D30 to have the same equation, relative to their adjacent cells. Something like this =sum(cell to the left, cell above). Let me know if you need more elaboration, or if you have the answer, great!
Solution
Paste this formula in the first cell next to your numbers or take a look at the Example Sheet
=IF(C2="",,IF(ISNUMBER(D1),C2+D1,0))
Explanation
We check the above cell ISNUMBER if so we calculate C2+D1 if not we put 0
IF(C2="",, to calculate onlt when the range C2:C is not Empty.
If you are looking for a single formula you can also try
=INDEX(IF(ISNUMBER(C2:C), SUMIF(ROW(C2:C),"<="&ROW(C2:C),C2:C),))

How to apply formulas in rows with unknown no of columns?

This works:
This does not:
I don't know why.
EDIT:
Thanks to Marios this works:
=ARRAYFORMULA( IF(B5:5 = "Start","",IF(
B6:6-A6:6>-1,B6:6-A6:6,0)))
"Start" to be changed to a named range with the actual date at the top of the sheet.
Explanation:
You are trying to execute this formula:
=ARRAYFORMULA(C6:6-B6:6)
in cell C7.
The issue with that is this part B6:6. This is a range of columns starting from B until the last column in your sheet, but since you put that formula in cell C7 your starting point is column C.
Essentially, you want to put the range of values from column B until the last column of the sheet but your available space is from C until the last column of the sheet and therefore you lack 1 column as the error also suggests.
An analogy would be:
fit a big box inside of a smaller one with a size difference of one column. In this case the big box is the range of B6:6 and you are trying to put it in a smaller box of a range C6:6.
Solution:
Try to put that formula on cell B7 and it will work. Don't drag it, because the big range will shift to column A and you will face the same issue. Just use the same exact formula on cell B7:
=ARRAYFORMULA(C6:6-B6:6)
While this might not be your goal, it explains what is the current issue you are facing and what to do in order to fix it.
Update based on your solution:
=ARRAYFORMULA(iferror(IF(B5:5 = "Start","",IF(B6:6-A6:6>-1,B6:6-A6:6,0)),""))
I added an iferror check to catch the first error value caused by the string.
You should use this:
=ARRAYFORMULA(IF(B5:5 = "Start","",IF(B6:6-A6:6>-1,B6:6-A6:6,0)))

How to use arrayformula to dynamically join strings in google spreadsheet?

I use Arrayformula() to make my reports dynamic and easier to edit. For example, if I have a Column A with a list o number o blue balls in a set and a Column B with a list red balls in a set, on the cell C1 I can write =ArrayFormula(add(A1:A,B1:B)) and in the Column C will have the total of balls in each set. It would be exactly the same as writing =A1+B1 in cell C1 and dragging the formula down to the last row. Arrayformula() has some benefits, because it will work if some adds or removes rows from the sheet and also it makes the reports way more organized and easier to edit.
Since I´ve discovered arrayformula(), my life has changed, because of the fact that googleSheets expands the formula to other cells. It does not work every time, but the idea of expanding to other cells seems to be possible some way or another, here is a good example of a problem that was not resolved by arrayformula(), but has the same idea.
Keeping that idea in mind, imagine that on Column A there is a list of First Names and on Column B there is a list of Last names. On Column C I want to join this two string using a simples space. The way to do that would be in the cell C1 write =join(" ",A1,B1) and then drag down this formula. This method method however is prone to error since people can add and remove rows, deleting my formula. I want to use a formula that I can write in one single cell and it expands to other cells. I´ve tried =arrayformula(join(" ",A1:A,B1:B)), but it does not work.
Is that a way to do that using =arrayformula() or other native function?
I know I could write a script or custom formula to do that, but this is not my goal here.
I think this formula should work:
=arrayformula(A1:A&" "&B1:B)
In case you want to use a delimiter, you can do the following to have a clean result even though, A or B is not present in some cases:
ARRAYFORMULA(ifna(ifs(isblank(A1:A),,ISBLANK(B1:B),A1:A),A1:A&" - "&B1:B))

Detecting what row a google spreadsheet is in

Is there a way to make a formula that would detect what row it's in and I can copy and paste it into all instead of typing out a different formula for each one, since I have a very big spreadsheet.
I.E Divide column A, Current Row by two.
If I understood this correctly, you can have arrayformula in cell F2 that references E2:E. No need to figure out the rows... try:
=ArrayFormula(if(len(E2:E), E2:E/2,))
Note: according to your locale you may have to replace the comma's with semi colons.

Resources