Count 'Yes' from column K where year is 2014 in column B? - excel

I am trying to create an excel formula which will count all of the occurrences of the word 'Yes' in my column K where the year of the date in column B is '2014'.
Column B Column K
01/02/2014 Yes
03/04/2014 No
06/01/2014 Yes
08/02/2015 Yes
So I know how to get the year from my date in column b
=YEAR(B:B)
But now I want to combine this and put it into a countif formula which will count all of the yes's in my column k where the year in column b is 2014.
here's what I've tried to put together:
=COUNTIF(K:K="Yes",YEAR(A:A)=2014))
This doesn't work, please can someone show me where I'm going wrong.

Try this:
=SUMPRODUCT(--(YEAR($A$2:$A$5)=2014),--($B$2:$B$5="Yes"))
To make it more dynamic, i.e.: get the criteria from the matching row data, change the formula to this:
=SUMPRODUCT(--(YEAR($A$2:$A$5)=YEAR(A2)),--($B$2:$B$5=B2))
EDIT:
Maybe this is what we need, paste below formula to C2:
=SUMPRODUCT(--(YEAR($E$2:$E$5)=A2),--($F$2:$F$5=B2))

Maybe not the most elegant solution, but this would work :
Create 3rd column with formula : =YEAR(A2) & B2
And to get your count use : =COUNTIF(C2:C5; "2014Yes")

Related

Number occurrences in another cell (Excell) [duplicate]

I have simple problem, but I've not be able to get an answer from searching. I require a column to calculate the number of the nth occurrence of a value. It's best explained in this picture
I require a method to calculate column B.
I'd be very grateful for any help.
Are you looking to merely provide a count of the distinct entries of column A in column B? Or merely add a formula to come up with the table in your link?
If the latter, then the formula to write in cell B2 is:
=COUNTIF(A$2:A2,A2)
then copy/paste it down column B. Note - if your data is both a Date and Time, but the cell is formatted to only display a date, you may not get the results you want. You'd need to interject a new column with a "floor" calculation to round the date/time value to a date (Excel date times are decimal, with integer part dictating the date, and remaining 0.0 -> 1.0 dictating the time of day)
If you just want to derive a table of the counts of distinct entries in column A, then a pivot table will do this for you - simple add a pivot table to cover the data in column A, then select column A into the rows category, and then also drag it into the values category, ensuring the field is set to "Count of". You should then have a table with the distinct entries in your data set in one column, and the count of their occurrences in the other column.
You can use the COUNTIF worksheet function, with a relative address.
Eg. In cell B2, enter this formula:
=COUNTIF(A$2:A2,A2)
And then fill-down.
Use the following formula to generate the required series:
=COUNTIF($A$1:A1,A1) and strech(copy) it in all the cells
This will generate result like this:
A 1 COUNTIF($A$1:A1,A1)
A 2 COUNTIF($A$1:A2,A2)
C 1 COUNTIF($A$1:A3,A3)
C 2 COUNTIF($A$1:A4,A4)
B 1 COUNTIF($A$1:A5,A5)
B 2 COUNTIF($A$1:A6,A6)
A 3 COUNTIF($A$1:A7,A7)
C 3 COUNTIF($A$1:A8,A8)
D 1 COUNTIF($A$1:A9,A9)
D 2 COUNTIF($A$1:A10,A10)
D 3 COUNTIF($A$1:A11,A11)
D 4 COUNTIF($A$1:A12,A12)

IF statement formulas

Need assistance with creating a formula to calculate how many days of storage. The attached image of a spreadsheet that I use shows an array of dates.
I need a formula in column "E" "Live Days in SIT" that calculates the following:
1st: If column D & C have dates, subtract column D from C
2nd: If all columns have date, subtract column D from C
3rd: If column C is only cell with dates, subtract Todays date from column C
4th: If column C & B have dates, then subtract B from C
5th: If column C & A have dates, then subtract A from C
6th: If column A, B, C have dates, subtract the lesser dates from columns A & B from C
This is the formula I have created, but I receive a "False" statement when only column C has a date:
=IF(L4758=0,IF(J4758=0,IF(I4758=0,TODAY()-K4758)),IF(L4758>0,L4758-K4758,IF(L4758=0,IF(I4758=0,IF(J4758>0,J4758-K4758,IF(J4758<I4758,IF(J4758>0,J4758-K4758,IF(J4758>I4758,IF(I4758>0,I4758-K4758)))))))))
Thank you!
Try,
=if(count(a2:d2)=4, c2-d2, if(count(a2:c2)=3, c2-min(a2:b2), if(and(count(a2:d2)=2, c2<>0), c2-sum(a2, b2, d2), text(,))))
There are still some 'holes' in your logic but I suppose those are conditions that will never be met.
This should work, but I got a little confused as to which column should be subtracting from which. I followed your verbal commands, but my intuition says you probably are looking for a different method than the one you described. Here it is, you can adjust if need be.
=IF(AND(C6<>"",D6<>""),C6-D6,IF(AND(D6<>"",C6<>"",B6<>"",A6<>""),C6-D6,IF(AND(D6="",C6<>"",B6="",A6=""),C6-TODAY(),IF(AND(C6<>"",B6<>""),C6-B6,IF(AND(C6<>"",A6<>""),C6-A6,IF(AND(A6<>"",B6<>"",C6<>""),IF(A6>B6,C6-B6,C6-A6)))))))

Excel: Finding next equal match in column

I've googled for a solution to my problem for days and I just can't seem to get my head around how to do this.
I have 28 chickens and I track the eggs each one lays each month. My Excel sheet looks like this:
Current Egg-cel sheet
Column C is populated by the formula:
=LARGE($A$2:$A$29,$B1)
I'm using column B to increment the LARGE function
I want column D to populate with which chicken number laid the quantity in column C.
Obviously INDEX MATCH or VLOOKUP returns the first match for all equal values. How do I find the the next match? i.e.
Egg-cell sheet 2
I've seen similar questions and solutions but I for the life of me can not get it to work.
Use this formula in D2:
=INDEX(B:B,AGGREGATE(15,6,ROW($A$2:$A$29)/($A$2:$A$29=C2),COUNTIF($C$2:C2,C2)))
And drag down
If you're happy to add a few helper columns, this is a simple way to go:
The formula in column C creates a unique number by bringing together the eggs laid and the chicken number
=--(A2&"."&B2)
Column D is just your LARGE formula,
=LARGE($C$2:$C$4,B2)
Column E just gets the integer part of column D
=INT(D2)
And finally Column F gets the decimal part (chicken number) from column D
=--REPLACE(MOD(D2,1),1,2,"")

What is the best way to update the match formula to conditionally format?

=MATCH(C$13, 'Vacation - Holiday'!$B:$B, 0)
C13 is the date 01/01/2016.
I am using this formula to conditionally format a cell in a calendar dashboard. It works great but I need the lookup array to be dependent on the name listed in cell B15.
Can I use AND(Match())? I have tried many things and feel so close but so far.
"Meg" is the header of the "B" column on sheet 'Vacation - Holiday'!$B:$B. There are names in columns A - J.
A B C D E F G H
1/1/2016 1/4/2016 1/5/2016 1/6/2016 1/7/2016 1/8/2016
Meg
The formula you want is:
=ISNUMBER(MATCH(C$13,INDEX(Sheet6!$A:$J,0,MATCH($B15,Sheet6!$1:$1,0)),0))

Calculate Occurrence Number - Excel

I have simple problem, but I've not be able to get an answer from searching. I require a column to calculate the number of the nth occurrence of a value. It's best explained in this picture
I require a method to calculate column B.
I'd be very grateful for any help.
Are you looking to merely provide a count of the distinct entries of column A in column B? Or merely add a formula to come up with the table in your link?
If the latter, then the formula to write in cell B2 is:
=COUNTIF(A$2:A2,A2)
then copy/paste it down column B. Note - if your data is both a Date and Time, but the cell is formatted to only display a date, you may not get the results you want. You'd need to interject a new column with a "floor" calculation to round the date/time value to a date (Excel date times are decimal, with integer part dictating the date, and remaining 0.0 -> 1.0 dictating the time of day)
If you just want to derive a table of the counts of distinct entries in column A, then a pivot table will do this for you - simple add a pivot table to cover the data in column A, then select column A into the rows category, and then also drag it into the values category, ensuring the field is set to "Count of". You should then have a table with the distinct entries in your data set in one column, and the count of their occurrences in the other column.
You can use the COUNTIF worksheet function, with a relative address.
Eg. In cell B2, enter this formula:
=COUNTIF(A$2:A2,A2)
And then fill-down.
Use the following formula to generate the required series:
=COUNTIF($A$1:A1,A1) and strech(copy) it in all the cells
This will generate result like this:
A 1 COUNTIF($A$1:A1,A1)
A 2 COUNTIF($A$1:A2,A2)
C 1 COUNTIF($A$1:A3,A3)
C 2 COUNTIF($A$1:A4,A4)
B 1 COUNTIF($A$1:A5,A5)
B 2 COUNTIF($A$1:A6,A6)
A 3 COUNTIF($A$1:A7,A7)
C 3 COUNTIF($A$1:A8,A8)
D 1 COUNTIF($A$1:A9,A9)
D 2 COUNTIF($A$1:A10,A10)
D 3 COUNTIF($A$1:A11,A11)
D 4 COUNTIF($A$1:A12,A12)

Resources