I have collision data in column F I have the years from 2004-2015, I have named the range ATT_YEAR and In column G I have the dates and the range is named ATT_DATE. What I am trying to do is to either use COUNTIFS or SUMPRODUCT to determine the number of collisions by month of the year, if I select the year as say 2013, I want to show the number of collisions by month.
I was trying the following the formula:
=COUNTIFS(ATT_YEAR,"2013",ATT_DATE,MONTH=1)
but not getting very far with one.
Or when I tried using sumproduct formula:
=SUMPRODUCT(--(ATT_YEAR,"2013"),MONTH(ATT_DATE)=1)
I would be grateful for any assist on either of these.
I think you are using the formula wrong:
=SUMIFS(COLLISION,ATT_YEAR,2013,ATT_MONTH,1)
This will count all collisions in the named-range "COLLISION" only if 2013 is matched in the named-range "ATT_YEAR" and 1 (i.e. January) is matched in the named-range "ATT_MONTH".
edit
Needs updating, wrong assumptions.
You cannot use MONTH, which is the function you need, inside COUNTIFS. Instead, create another column, with the formula MONTH(B2), assuming column B has the date values, and use it as a new ATT_MONTH range:
=COUNTIFS(ATT_YEAR,2004,ATT_MONTH,6)
Related
I have a calendar year in Column A and am looking to find a match in column CA. There are multiple matches and within these I am then looking for the match that has "A" in the row next to it. there could be duplicates of this as well and so of those will copy the max value (In column CK). At the moment I have tried some looped vlookup() excel functions but have had no luck. Any help would be appreciated, thanks!
=VLOOKUP(A2&"A", $CA:$CK, 11, FALSE)
Use INDEX/MATCH instead of VLOOKUP().
=INDEX(CK:CK,MATCH(A2&"A",CA:CA&CB:CB,0))
In case of non 365 version of excel, you may need to array entry the formula with CTRL+SHIFT+ENTER.
I'm trying to make a COUNTIF that checks range E8:AI8 for the letter "D" and the range E7:AI7 for any of the following numbers 2;4;8;9;15;20;26;27;33;34;40;41
Also cells in range E5:AI5 to not equal any cell in C105:C118
E5:AI5 is dates in a calender.
C105:C118 is a list of dates for holidays.
My formular so far is looking like this:
Sumproduct(countifs($E$8:$AI$8;"*D*";$E$7:$AI$7;
{2;4;8;9;15;20;26;27;33;34;40;41};$E$5:$AI$5;"<>"&$C$105:$C$118))
However its not really turning out like i want it, the first two parts of the fomula are working as intended, but the last part comparing the row to the list of dates is not. Is it even possible to compare a row to a column? Or is there another way to do this?
That is not something you can do really inside a COUNTIFS() as described here. Consider to use SUMPRODUCT() with some MATCH() nested inside:
=SUMPRODUCT((E8:AI8="D")*(ISNUMBER(MATCH(E7:AI7,{2,4,8,9,15,20,26,27,33,34,40,41},0)))*(ISNA(MATCH(E5:AI5,C105:C118,0))))
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 have a time tracker and trying to count time spent in a given week using SUMIFS.
The week column is a formula that gets the week number from the date, and not a value by itself, and that seems to be tripping up the SUMIFS calculation, and it just returns SUM of zero. If I replace the formula with a written week number, it works.
Is there a way to force SUMIFS to work with the formula, or make it see the value of the cell instead of the formula?
A B C D
wk48 johnny 29-11-18 misc 10
wk48 johnny 29-11-18 inbound 130
wk48 johnny 29-11-18 meeting 30
Column A is =WEEKNUM(C,2).
My SUMIFS formula is =SUMIFS(D:D,A:A,"wk48"), but like I said, it only returns zero. If I change the data in column A to be just text instead of getting the week number by formula, it works just fine.
(I'm using SUMIFS instead of just SUMIF because I want to add other criteria as well, but for now I'm trying to get the individual criteria working before combining them together, and I'm stuck on this one.)
Any ideas? Thanks.
the WEEKNUM formula returns numbers, 48 in your case, and not the string "wk48". I suspect this is how the cell is formatted (the same way you can have a dollar sign in front of a number). Try =SUMIFS(D:D,A:A,48).
I would like to run a function in Excel 2010 which has to:
check which cell in a specific range contains a name
if the previous task is true, sum the adjacent cell
Example:
In range B2:B227 there are some names, like Acura, Audi, BMW, Cadillac, etc.
In range C2:C227 there are the number of cars those manufactures sold in 2012.
I want to calculate the sum of cars sold by certain manufacturers.
I was thinking about something similar, but it doesn't work. I think I made a mistake on the first step (recognize the names in cell B2:B227).
=SUMIF(B2:B227,OR("Audi","Acura","BMW","Cadillac"),D2:D227)
Thank you,
Gianluca
You can use SUMIF but as the result is an array (one sum for each criterion) you need to use SUM or SUMPRODUCT around the SUMIF to get the total, e.g.
=SUM(SUMIF(B2:B227,{"Audi","Acura","BMW","Cadillac"},D2:D227))
or list Audi, Acura etc in a range of cells e.g. K2:K5 and use this version
=SUMPRODUCT(SUMIF(B2:B227,K2:K5,D2:D227))
I originally looked at something like the below link, but I dont think this allows you to SUMIF based on criteria.
If cell contains 1 or more keywords, change value of a different cell
It would appear you can longer use the SUMIF for multiple criteria according to this article.
Ok, so if we need to sum a range of cells where corresponding cells (on the same row) meet 2, or more conditions we can no longer use the SUMIF. The formulas we can use, in order of their efficiency, are
DSUM Download advanced examples of DSUM
SUMPRODUCT
SUM with and IF function nested and entered as an array formula. See Array Formulas for details
For more on the different options available, this article should be very helpful
=(SUMIF(A5:A230,K5:K15,C5:C230))