Conditional 'counta' argument (dependent on year)

Lau99

New Member
Joined
Nov 12, 2014
Messages
3
Hi all,

I'm having trouble with the argument below....

2005200520052006200620072008200820082009
JanFebMarJanJunJanJanFebMarFeb
1200031442
2355099000
1230031442
2300040001

<tbody>
</tbody>


I want to find out how may years hold positive counts (the count itself, nor the number of months with counts, matter). The following code works if I select the range for a single year......

=IF(COUNTA(A1:C1)>0,1,0)

.... but I have multiple spreadsheet, and there is no standard number of results per year. Ideally, I'd like to find one line of code that will do the above (give a '1' if there has been a positive result within the selected range of cells), but make it dependent on the year so that I don't have to manually select the range for each year. So far I can only think how to do this with one formula per year, so still several formulas but no need to select the range for that year (does that make sense??)

What I want it to say is: 'If row one = 2005, return 1 if cells in row 2 >1, else return 0'

I feel like this should work but it doesnt.....

=IF(1:1=2005,(COUNTA(2:2)>0,1),0)

In addition, if anyone can see how to do this in one simple formula to incorporate all years, that would be amazing!!!!

Sorry for the long winded explanation,

Thanks,
Laura
 

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Why are you checking row 2, that just contains month names, are you just trying to check for any value greater than 0 in any given year?
 
Upvote 0
Argh sorry, formulas amended below:

I need to know how many years have a value great than zero (in any month) - so the answer would be 4 for the first three rows, and 3 for the last row......the way I'm trying to do it at the minute is to have a separate cell for each year, then add them up at the end.

Hi all,

I'm having trouble with the argument below....

2005
2005
2005
2006
2006
2007
2008
2008
2008
2009
Jan
Feb
Mar
Jan
Jun
Jan
Jan
Feb
Mar
Feb
1
2
0003
1
4
4
2
2
3
5
5
09
9
000
1
2
3
003
1
4
4
2
2
3
0004
0001

<TBODY>
</TBODY>


I want to find out how may years hold positive counts (the count itself, nor the number of months with counts, matter). The following code works if I select the range for a single year......

=IF(COUNTA(A3:C3)>0,1,0)

.... but I have multiple spreadsheet, and there is no standard number of results per year. Ideally, I'd like to find one line of code that will do the above (give a '1' if there has been a positive result within the selected range of cells), but make it dependent on the year so that I don't have to manually select the range for each year. So far I can only think how to do this with one formula per year, so still several formulas but no need to select the range for that year (does that make sense??)

What I want it to say is: 'If row one = 2005, return 1 if cells in row 2 >1, else return 0'

I feel like this should work but it doesnt.....

=IF(1:1=2005,(COUNTA(3:3)>0,1),0)

In addition, if anyone can see how to do this in one simple formula to incorporate all years, that would be amazing!!!!

Sorry for the long winded explanation,

Thanks,
Laura
 
Last edited:
Upvote 0

Forum statistics

Threads
1,216,037
Messages
6,128,442
Members
449,453
Latest member
jayeshw

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top