Shalom Rabbi! Can a mechalel shabbat be counted as part of a minyan?
The Mishna Berura (סימן נה ס”ק מו) writes that one who desecrates Shabbat in public has the status of a non-Jew and cannot be counted for a minyan. There are, however, two sources to permit counting such a person for a minyan. The first source is Rav Moshe Feinstein. Rav Moshe quotes the Gemara(סנהדרין עד) that learns from the meraglim (spies in the desert) the halacha requiring ten Jews for tefila. The meraglim themselves were heretics; how can we learn from heretics the halachot of minyan? Rav Moshe answers that we may learn from there that it must be heretics can count towards a minyan (אגרות משה או”ח א סי’ כג, או”ח ב סי’ יט).
The second source for permitting a mechalel Shabbat to be counted towards a minyan is the Rambam (ממרים פרק ג הל’ ג) that write if one was born amongst non-believers, they are a lost child and do not have the status of a heretic, even if they are non-believers. Many Poskim rule that this Rambam applies to all non-religious Jews of our times (מלמד להועיל כט, חזון איש א ו, יביע אומר או”ח ז טו). There are some who disagree, especially when the non-religious Jew lives or was raised in a community with exposure to religious Jews (מעדני שלמה עמוד כז).
In a time of need one may rely on Rav Moshe and the others who rule that one can count a mechalel Shabbat for a minyan.
All the best