No formulas, but there are some rules of thumb / factors to consider:
1. The less stable / more intermittent your income, the more cash you are recommended to have.
2. The less access to credit (credit cards, lines of credit, HELOCs) you have, the more cash you are recommended to have.
3. The less wealth you have ... more cash.
4. The more high interest debt you have, the less cash you are recommended to have (pay off the high interest debt instead).
5. The more conservative you are financially, the more cash you should have.
6. If you're married and your partner works ... less cash.
7. Economic uncertainty. Currently nobody suggests more than six months of expenses. When the next recession comes, some gurus will change their recommendation to up to 9 to 12 months of expenses and hope you don't notice that they change their recommendations based on how the economy is doing.
I'm FIREd, have six figures of credit lines available to me, have zero high interest debt, am moderately aggressive, I'm single, and I think the economy is doing well for now. I tend to keep between 1 and 3 months cash in total, with about $1,000 of that in checking and the rest in an online bank high yield savings account.