What is the difference between erledigen and machen? Is one more formal and the other isn't?
Ich erledige morgen meine Einkäufe.
Er macht am Abend seine Hausaufgaben.
Machen is super generic and can be used for pretty much any situation in which something gets done. The focus is on the doing rather than on the finishing. The translation is to make as in to produce.
Ich mach einen Kuchen.
This means that you are making a cake and that implies that you'll finish the work. It is not good style but people do use machen sometimes even if other verbs would be more precise and idiomatic.
Erledigen is much more narrow. It means to get done and it only works for tasks. The focus is not so much on the doing but on the finishing it and you cannot erledigen random objects. You can just erledigen tasks.
Ich erledige die Einkäufe.
That works because Einkauf while being a noun, is also a task.
Ich erledige einen Kuchen.
This doesn't work because a cake is not a task. You can erledigen the baking, but that's it. So erledigen is a subgroup of machen . You can always replace it with machen but NOT vice versa.
I guess we should also mention that one can also erledigen living beings. That basically means to kill or at least to defeat.
"machen" is almost as versatile as "to do" in English. For written texts try to find more suitable words, although in conversations "machen" is quite often used.
You can hear sentences like "Ich mache Urlaub", "Ich mache Hausaufgaben", "Ich mache einen Tisch". But you should write "Ich fahre/fliege in Urlaub", "Ich erledige meine Hausaufgaben", "Ich baue einen Tisch".
So yes, one is more formal (and less versatile) than the other.
It is difficult, because machen is idiomatic in some contexts, but in other contexts it is better avoided.
Examples where you need not replace machen, though of course, it is almost always possible:
Mach, daß du weiterkommst! Get lost!
Possible replacement would be Sieh zu.
Mußt du immer Schwierigkeiten machen? Do you really need to make trouble all the time?
Possible replacement would be bereiten.
Das macht nichts. It doesn't matter.
Das macht Spaß! It's fun!
No replacement in the preceding two examples.
Mach hin! Quick!
Alternative would be Beeil' dich!