SUMIF function adding up time with criteria in another cell (date) - sumifs

Say I have to sum up the cells in column I if their corresponding cells in column B >= the value in specific cell, E5.
I've tried SUMIF(I9:I12,"<="&E5,B9:B12) and it didn't work. Actually the result is 4307280:00.
Column B is formated to dd-mmm.
E5 cell is formated to dd-mmm.
Column I is formated to [hh]:mm.
result cell is formated to [hh]:mm.
How do you fix it so that the criteria of the SUMIF function involves the value in a specific cell? I'd like to set it this way because I have to add up the hours up to and including a specific date.
Thank You

Related

Conditional formatting based on adjacent cell value even when the first adjacent cell in row is blank

I would like to colour cell C3 red, as the value is less than the next filled cell on row 3 (E3).
You need custom formula in the formatting rules for range C2:W.
And you can use the formula below for green:
=and(not(isblank(C2)),C2>index(filter(D2:$W2,arrayformula(not(isblank(D2:$W2))))),1,1)
And make another conditional formatting rule with the same range and change > accordingly for red.
Note that the equal case does not have formatting in your example.
To understand why, there are a few components at work. I'll give an outline in case OP or any passer-by wants one.
First is how conditional formatting in Google Sheet works. I will be brief here. The range we put in the rule is C2:W. Google Sheet will use the beginning cell in that range as a reference. For C2:W, the 1st cell is C2. In the formula, the cells are read in terms of relative position to that reference cell. So when evaluating formatting for cell C2, it treats the formula as is. But, for example, when evaluating formatting for cell C3, Google Sheet iterates all non-fixed ranges by 1 row. Another example: for D3, all non-fixed ranges are iterated by 1 row and 1 column.
Whenever the formula evaluates to true, the format will be applied -- although that is subject to further formatting if you have subsequent formatting rules which apply to the given cell.
Next are the components of the conditional formula.
not(isblank(C2)) checks for blank cells and makes the whole formula only true when the cell is non-blank.
For filter() usage, please consult official documentation. I will explain how filter() is applied to your example.
In our use, we are trying to rid of empty cells in the range that is on the same row as the cell in question and goes from the next column to column W. (I am using column W because there is no known end column in your image. Please adjust to your application accordingly.) Same row as C2 means row 2. Hence the digit 2 in D2:$W2. No $ sign for row because row index is meant to iterate through our range C2:W in the formatting rule. No $ sign for D because we mean 1 column next to the cell in question and the exact column index should iterate. We fix column W because the end column does not evolve and is thus not meant to iterate. Neglecting this will not particularly change the result in your example. However, it is good to be clear with the meanings.
arrayformula(not(isblank(D2:$W2))) produces a local row array whose cells are true/false that each represents whether the corresponding cell is non-blank. filter() in turn only keeps cells from D2:$W2 for cells in arrayformula(not(isblank(D2:$W2))) that are true.
We only care about the 1st non-blank cell. To retrieve the 1st cell from a (local) array, we use index(...,1,1). (That said, omitting index() also happens to work for the 1st cell in particular because when comparing a single cell with > or < to an array range, only the 1st cell of the array is used.)
Apply a conditional formatting to the range desired (starting from cell C2) using this formula:
=IF(C2="",FALSE,OFFSET(C2,0,AGGREGATE(15,6,(COLUMN(D2:W2)-COLUMN(D2)+1)/(D2:W2<>""),1))>C2)

Count cells if they have date information

I would like to get a count of my cells that have date information.
The format is: ['2020-12-19T00:00:00.939Z', '2020-12-19T00:45:20.499Z']
However, the rest of the cells in that column have [] - not blank, so I can't just do a COUNTIF(A1:A100,"*"). I would like to know how I can format this COUNTIF statement to grab only the cells with date and time data, because also this date could range from any day in the last year. I am using Google Sheets, the latest version.
You can take advantage of the "short" nature of the cells you don't want counted:
sumproduct(--len(A1:A100)>2)
This assumes that you have either have date data or cells like [].
You can try this:
=sum(Arrayformula(if(Substitute(A1:A12,"[]","")="",0,1)))
Substitute cells without date "[]" with empty cell ""
Check if cells are empty set to 0 or 1
use arrayformula() to apply formula to all cell rows
get the sum of the arrayformula() which will give you the count of non-empty cells in your range
try:
=INDEX(COUNTA(IFNA(SUBSTITUTE(A1:A100; "[]"; ))))

Making a formula that checks for a sheet with the same name as the cell next to it

I have this formula which sums up several columns in another sheet. The sheet that the formula is referencing to always has the same name as the cell next to it.
Instead of having to rewrite the formula for every cell in the column, is there a way I can just simply check for a sheet with the same name as the cell next to it? The cell ranges will always be the same.
You should use INDIRECT formula. This allows you to write references as strings.
Instead of 'Round 3'!C5:C you can write: INDIRECT("'"&C2&"'!C5:C") (assuming that word Round 3 is in C3).
Whole function looks like this (assuming that active cell is D2)
=SUM(INDIRECT("'"&C2&"'!C5:C"),INDIRECT("'"&C2&"'!G5:G"),INDIRECT("'"&C2&"'!K5:K"),INDIRECT("'"&C2&"'!O5:O"),INDIRECT("'"&C2&"'!S5:S"))

Obtain first date in column after reference date

In cell B1, I have =today() for today's date and then in the cells below (B2:B100), What I'm trying to do is to compare the date in cell B1 (today's date) and to find the next date that appear in cells B2:B100 AFTER this date and then copy this into A2.
So, in effect, in cell A2, I want a function to look up the next date in cells B2:B100 that is the nearest one AFTER B1 and then copy this into A2. I know this is a formula to add in A2 but just unsure what formula to use.
I've tried this in cell A2,
=MIN(IF(B2:B100>B1, B2:B100))
but it didn't work.
"Other things being equal", the formula is correct but should be entered in the array version (eg with Ctrl+Shift+Enter):
=ArrayFormula(MIN(IF(B2:B100>today(),B2:B100)))
Building the function from B1 into the formula is optional.

Conditionally color Google Spreadsheet cell if value matches different column in same row

I have a Google Spreadsheet with data values in the first 10 columns (A through J) and the 11th column (K) has a reference value. This pattern repeats for 150 rows
So, for the first row, A1 through J1 are the data values and K1 is the reference value.
And for the 25th row, A25 through J25 are the data values and K25 is the reference value.
Now, for any data cell (cells within the first ten columns), where the value in the cell matches the value in the corresponding reference cell (at column K in the same row as the data cell), I want to change the background color of the data cell.
So, for data cell A1: if value in A1 == value in K1, change background color of A1
And, for data cell C23: if value in C23 == value in K23, change background color of C23
I assume that conditional formatting should be able to do this, but I could not figure out how. I know how to do conditional formatting for a single cell, but I can't figure out how to apply conditional formatting to the entire table (cells A1 through J150) at once.
Use the following custom formula in conditional formatting:
=A1=$K1
and apply to range A:J.
To exclude blank cells (and cells with zero-length text strings), try:
=AND(LEN(A1),A1=$K1)

Resources