Can English grammar be learned like a formula?

The short answer is yes. The grammar of any language is really a formula, or system. If there is no underlying structure or order to a language, the language wouldn't be much good to anyone. Some languages are very difficult to learn; English is really not one of the most difficult. If you want to learn a difficult language, try Icelandic.

On the other hand, although grammar is a 'formula', English is full of traps in the form of exceptions. I don't envy anyone who faces the task of learning English as a second language. I do, however, have the deepest respect and admiration for people who are.