I am trying sum rows that have the same month date. I have a formula that operates with columns but fails when rows are requested. I will show the formulas that I have tried, but I am now stuck. Any advise would be much appreciated.
=SUMPRODUCT(--(MONTH($A$9:$A$50)=5),$B$9:$B$50)
This array works fine with a column
=SUMPRODUCT(--(MONTH($A$9:$A$50)=5),$B$9:**$H$50**)
see the bold reference which comprises a series of cells set out in rows.
SUMPRODUCT normally expects ranges to be the same size but you can get the result you need with a change to the syntax, i.e.
=SUMPRODUCT((MONTH($A$9:$A$50)=5)*$B$9:$H$50)
You can't have any text in B9:H50 otherwise you will get #VALUE! error. If you do have text in that range then you can use this version, which should ignore the text and give you a result
=SUMPRODUCT((MONTH($A$9:$A$50)=5)*ISNUMBER($B$9:$H$50),$B$9:$H$50)
Related
Im trying to count the duplicated values between the 2 row so im using the formula as you can see it in the image =SUM(COUNTIFS(E4:S4,{"1","2","3"}))
so I have to write the numbers so I dont want write the numbers I want select the cells instead, any formula would do that? I already searched and tried many things but nothing seem to work
Put those values in cells - and refer to those cells as condition.
Next level: insert those values in a table, that you eg. call FilterBy and the column values
Then you can us this formula:
=SUM(COUNTIFS(E4:S4,filterBy[Values]))
Hat I don't understand: why are you using SUM - like this, it doesn't make sense, as COUNTIFS returns one value.
If you want to some all filtered values then you need this formula:
=SUM(SUMIFS(E4:S4,E4:S4,filterBy[Values]))
Good day.
In it's basic form, I need to count how many cells are empty.
Using the following below, I can count how many cells are empty.
=COUNTIF(Sheet1!C:C,"<>")
However, if the cells in column C contain formulas, it won't work.
After some googling, I found out that using SUMPRODUCT will get what I need
=SUMPRODUCT(--(LEN(Sheet1!C:C)>0))
Now, here's my problem.
I need to use that as a criteria inside a COUNTIFS function, but I don't know how to do that because it's referencing some ranges.
So just to make it simple, using COUNTIF or COUNTIFS function specifically, how can I pass a criteria that checks if cell (with formula) is empty.
This formula returns 0 but most likely I'm just not passing it properly as a criteria.
=COUNTIF(Sheet1!C:C,SUMPRODUCT(--(LEN(Sheet1!C:C)>0)))
Happy for other ways to count cells (with formulas) which are empty, but I need to use it as a criteria for a COUNTIF/COUNTIFS function.
Thank you very much.
If I understand what you're looking for, you were pretty close already.
Following the formula's you already found you can use them like:
=COUNTIF(Sheet1!C:C,"<>")-SUMPRODUCT(--(LEN(Sheet1!C:C)>0))
It will result in the count of cells that have a value/formula minus the count of cells that show a value (blank formula result is excluded).
The result is the count of cells that contain a formula with blank result.
I'm trying to count the number of distinct text from a specific date in a data table.
Data Sample with expect result :
I was able to figure out how to count the distinct element from a range I specify, because I can determine the first and last row containing the date.
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
I have tried to modify my formula so that it determines the cell range by itself but without success.
I searched for an answer, using a combination of CELL and MAXIFS, example below, but Excel does not accept the formula.
=CELL("row",MAXIFS(A2:A15,A2:a15,D2))
I've looked at the INDEX formula, but I can't figure out how to do what I want to do. 😑
Any idea what I'm doing wrong, or what I should be doing instead?
Thanks, I appreciate it!
If you have Office 365 and the new Dynamic Arrays, this sort of formula has become ridiculously easy.
This formula in cell E3:
=COUNTA(UNIQUE(FILTER($B$2:$B$15,$A$2:$A$15=D3)))
Copy down.
You can also generate the unique list of dates with this formula in D3, which spills down automatically and does not need to be copied.
=UNIQUE(A2:A15)
It wasn't easy, but by separating each step of the problem, I was able to solve it.
Note that my solution only works because my dates are sorted.
Here's the final formula in the cell "One formula to rule them all":
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2))),INDIRECT(CONCATENATE(ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2),":",ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)))))
Here are my explanations of my process:
Formula if I select the range :
=SUMPRODUCT(1/COUNTIF(B2:B15,B2:B15))
Formula to get the first iteration
=ADDRESS((MATCH(D3,$A$2:$A$15,0)+1),2)
Formula to get the last iteration
{=ADDRESS(MAX(($A$2:$A$15=D3)*ROW($A$2:$A$15)),2)}
Create range from two addresses
=INDIRECT(CONCATENATE(F3,":",G3))
Formula giving me the expect result
=SUMPRODUCT(1/COUNTIF(INDIRECT(CONCATENATE(F3,":",G3)),INDIRECT(CONCATENATE(F3,":",G3))))
I'm working on a spreadsheet and I need to have a set of cells ignored if they are blank. I tried a regular average formula as well as if statements and nothing seems to be working. The values need to be adjusted so they come to a common value. Here is the formula I am trying to use to calculate the average.
=(AVERAGE(D4,(F4*0.6),(H4*(6/7))))
This formula will calculate the average but is not ignoring cells that do not have a value.
Excel should automatically ignore truly blank cells when using the =Average() formula. However, if you do have some "0" data or space characters, you could use the following to find the average of anything that is numeric:
=SUM(A:A)/COUNT(A:A)
Where A:A is your range.
EDIT: Simplified to use Count which only finds numeric cells.
EDIT 2: Given your specific example, the average function could look as follows:
=IFERROR((D4 + (F4*0.6) + (H4*(6/7)))/COUNTA(D4,F4,H4), 0)
I've put together an Excel spreadsheet to keep track of employees' time off using an array formula. The formula works for date ranges that are entered as "mm/dd - mm/dd", but I'd like it to also support single dates "mm/dd". However, I get a #VALUE! error when one of the cells in the range is of this format, even though the formula supports both formats when not entered as an array formula.
Example:
With the value "11/28" in cell B2, and a table of holidays in B31:B37, the following formula accurately calculates the number of work days as 1.
=SUM(IF(ISBLANK(B2),0,(IF(ISERR(FIND("-",B2)),NETWORKDAYS(B2,B2,$B$31:$B$37),NETWORKDAYS(LEFT(B2,5),MID(B2,FIND("- ",B2)+2,5),$B$31:$B$37)))))
If the value of B2 is "11/28 - 12/03", the formula returns 4.
I want this formula to work over a range of of cells for each employee, so I expand the range from "B2" to "B2:B10", and enter as the following array formula:
=SUM(IF(ISBLANK(B2:B10),0,(IF(ISERR(FIND("-",B2:B10)),NETWORKDAYS(B2:B10,B2:B10,$B$31:$B$37),NETWORKDAYS(LEFT(B2:B10,5),MID(B2:B10,FIND("- ",B2:B10)+2,5),$B$31:$B$37)))))
This formula works fine when every cell in the range is blank or has a date range of "mm/dd - mm/dd". However, if one of the cells has a single date "mm/dd", it throws a #VALUE! error.
What am I missing?
If there is no "-" in a given string then the FIND function will return a #VALUE! error for that string.
In general, there are two ways to resolve such issues. One is to include an error trap; the other, slightly longer though perhaps nevertheless preferable (IFERROR clauses are generally best avoided if possible), is to make suitable amendments to the strings being passed to MID and FIND such that this combination of functions does not error, whilst also ensuring that correct results are returned.
One such solution (still array-entered) is:
=SUM(IF(B2:B10<>"",NETWORKDAYS(LEFT(B2:B10,5),MID(B2:B10&"- "&B2:B10,FIND("- ",B2:B10&"- ")+2,5),$B$31:$B$37)))
Regards