Why can’t women count in a minyan for prayer? R. Aryeh Frimer wrote a definitive article on the subject over twenty years ago (link). What follows is my own summary of his article, presented mainly to emphasize the broad consensus on the point that women cannot be counted.
There are three schools of thought on this:
I. One school posits that women are never counted in any minyan for any subject, even something in which they are obligated. Tosafos (Berakhos 45b sv. ve-ha), Ran (Megillah 5a) and other rishonim adopt this approach. Among acharonim, the Vilna Gaon (Bi’ur Ha-Gra, Orach Chaim 199:6), Shulchan Arukh Ha-Rav (199:6-7; 263:22; kuntres acharon 7), Minchas Chinukh (296:10), Or Samei’ach (Hilkhos Berakhos 5:3), Binyan Tziyon (vol. 2 no. 8 ) and others follow this approach. Different reasons are offered, which include comparisons to the biblical censuses in the desert, inheritance of land in Israel, prior obligations to family and public vs. private roles.
II. Another approach counts women for a minyan in anything for which they are completely obligated. Since they are not obligated in public prayer, they do not count for that minyan. This approach is adopted by the Shevus Ya’akov (Orach Chaim 3:54), Teshuvah Me-Ahavah (2:229), Toras Chesed (Orach Chaim 4), Tzitz Eliezer (9:11) and others.
III. A third approach distinguishes between a minyan required to publicize a matter and a minyan that is intrinsic to the performance of a ritual. Women count for the former but not the latter. The Re’ah, quoted by the Ritva (Megillah 4a), adopts this approach. The Chazon Ish (Orach Chaim 155:2), R. Chaim Sonnenfeld (Salmas Chaim 1:101), R. Tzvi Pesach Frank (Mikra’ei Kodesh, Purim 35, 50 n. 3), R. Ovadiah Yosef (Yalkut Yosef, p. 90) and others follow this approach.
The details of this debate are reflected practically in a number of cases. For example, can women count for a minyan in the reading of Parashas Zakhor, assuming they are obligated in it? Can they count for a minyan in the reading of megillah or the public lighting of a Chanukah menorah? The approach you follow will determine your answer to these questions.
However, there is a universal consensus that women cannot count in a minyan for public prayer.
(See also this post: link)