SUMIF sum value in next column over - google-sheets

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")))

Related

Google Sheets - ArrayFormula - XLOOKUP

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.

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),))

Highlight cell if value is different from the preceding cell

I'm have a number of columns (A / B / A / B / A / B etc) and I want the cells from column A to highlight if they are different from the cell in the preceding column A in the same row. And the same for columns B.
If the cell in the preceding column is empty, I don't want the cell to get highlighted.
This is what I want to achieve
I tried this in Google Sheets (range F4:M22) and then Custom Formula, which comes somewhat close, but not quite:
=IF(F4="","",F4<>H4)
If feel like there should be a simple solution, but I've been going around in circles. Any help much appreciated.
Select all columns except the first and second one. Create a conditionnal formating with
=C1<>A1

How to write a formula that would work in different rows?

I'm trying to make a Google spreadsheet where I want the sum of the values in the row to appear in the AH cell of that row.
The row would be populated with letters like L or X and I'm using COUNTIF to give value to the alphabet characters.
For example,
=COUNTIF(C4:AG4,"X")*9 + COUNTIF(C4:AG4,"L")*12
How can I write the range such that it looks at cells C through AG from the same row the formula is in rather than change it for every row?
You don't need to change the formula, if you write that formula in one cell and then you drag the little square at the bottom right of the cell, excel will automatically change the row number
Just copy downwards:
As you see, the row index changed to 5 automatically.

Google Sheet Dynamic Sum

I am using google sheets to make a spread sheet and do some simple math, I figured how to do the summing but the problem is that I have about 180 rows of data and want to avoid, if possible, the need to make a formula for every single pair of data. Here is the simple code that I have:
=SUM(AG4:AG5)
So I am writing this code in this case in AH4 and is always the same relative placement to the values I want to add. I want the sum of the two numbers one column to the left and the current row and a row under that. Is there any way to make it so that the same formula can be used over and over instead of typing each one out. Maybe some way to make the formula look one column to the left take that number and add it to the cell one column to the left and one row down?
Thanks for any help you can provide.
You can use the ARRAYFORMULA function to apply a formula to multiple rows. It does not like some functions, though, and SUM() is one of them. So we need to use a different method to add the numbers. In this case, we just use AG4 + AG5. To apply the formula to all the rows in the spreadsheet we do a little more. Here is the formula, which would be placed in cell AG3 provided that is where the formula should start adding items.
=ARRAYFORMULA( IF( ISBLANK( AG3:AG),, AG2:AG + AG3:AG))
The IF ISBLANK AG3:AG) causes the formula to be applied to every row from row 3 to the last row in the sheet. ISBLANK will return FALSE on any row we want to work on so we provide nothing to teh TRUE portion of the IF statement. Note that I did not put "" in for the TRUE portion as that actually places a value in the row and can cause problems with other formulas. Since we are placing this in cell AG3 the addition will increment adding the row above to the current row.
EDIT from Comments
Placing this in cell AH2 will get you what you want:
=ARRAYFORMULA( IF( ISBLANK( AG2:AG),, IF(iseven( ROW(AG2:AG)),AG2:AG + AG3:AG,)))
Taking it a step farther, placing this in cell AH1 will label the header row for you and keep the formula out of the data rows. This has the advantage of allowing rows to be inserted above row 2.
=ARRAYFORMULA( IF(ROW(AH1:AH) = 1, "Total", IF( ISBLANK( AG1:AG),, IF(iseven( ROW(AG1:AG)),AG1:AG + AG2:AG,))))
The explanation is similar to above, only minor changes were made.
NOTE: The rest of column AH (below the formula) should not have any other manually entered data, so you will have to delete your formulas.

Resources