Using conditional formulas could work for this but it, unfortunately, can't infer if it's in fact a country or not, it will only return the available results that are stored in that cell. For example, some may only mention the city or state and that's what it will return, if the country is present then it will return it.
Yep, as mentioned, the formula generator doesn't have context or can't infer every country on its own so if you try to do that you'll have to specify what it returns based on the input which could be tedious.For example, some rows only have "San Francisco" or another city but doesn't mention the country. When you prompt the formula generator you'll have to specify that if it says "San Francisco" then return "United States" or "US", and will have to do this for every city that is formatted this way.Hence, chatGPT will be easier to get around that issue since it already has the context, all you need is to prompt it and provide the input.