awrex,
First welcome to the board. In the future, you need to tell us what version of Excel you are running and you need to be more specific about what you are doing.
It sounds like you need to use an "IF" statement.
=IF(COUNTIF(B:B,B1)>0,COUNT(A:A))
This assumes Column B (Column 2) contains a predetermined value in Cell B1, then it counts everything in Column A (Column 1).
I am guessing because your description did not go into detail. I hope this helps. You can always reply back with more information, or repost a new question.
Regards,
Charles