I have a sheet, with live data extracted from an SQL database.
I need to count the amount of entries that have specific data in 2 columns (There are more columns), column A has for instance “1” and column B has “yes”.
I need to know how many rows have both “1” and “yes” in.
Simple enough? Well if it is, it’s evading me.
Please help
=COUNTIF(A1:A5,“1”)
=CountIF(B2:B5,“YES”)
Step, cheers, I got that far but it’s essentialy adding the two commands togeather I’m after, so it only counts is both criteria are met in the same row.
I tried this [ =SUM(IF(K2:K4000=1,( IF(D2:D4000=4,1,0)),0),0) ] but it too fails
Please help
Use .Value at end of should do the trick…like
A6.Value + B6.Value (You can do your if statements also but use the .Value)
I’ve got it to work with this
=SUMPRODUCT(–(‘From Sunrise’!$K$2:$K$1000=1),–(‘From Sunrise’!$D$2:$D$1000=A20))
but I have a new problem. when the ammount of data changes on the sunrise page the 1000 figure changes, going up or down depending on the ammount of extra / removed data.
Any ideas.
It’s a bit lazy but you could replace the 1000 with something bigger than you ever expect your data to get, it’s not a great solution but it’ll work (at least until you end up with more data than you anticipated :p)
A better solution would be to use a “dynamic named range”. It’s a clever trick that I picked up a few years ago. Essentially you define a named range using a formula rather than a fixed reference. The formula allows the actual range to grow in size depending on where the end of the data is. Then in the formula you have above you just reference this range by it’s name.
Unfortunately I’m unable to give any precise help until Monday as I’m off work for the rest of the week and I don’t think I’ve got a spreadsheet that uses this technique at work. Google might help though, I think I originally got this technique from mrexcel.com
EDIT - found a link:
http://www.ozgrid.com/Excel/DynamicRanges.htm
whoop de doo da, thats going to make my life easier
I think…