My macbook air mid 2011 no longer connects to 5g WiFi
As you mentioned in your comment, it works sometimes. Then, I would recommend to flush DNS of your MacBook and try it again as a first step. 

Flush the DNS cache by typing:

  dscacheutil -flushcache


Forget network and try to connect it back. 

Other professional steps to know more on it:

Run Apple Diagnostics:

If you still haven't solved your Wi-Fi worries you could use Apple Diagnostics to check for Wi-Fi or network issues.

To do so follow these steps:


Disconnect all external devices (except the keyboard and screen).
Shut down the Mac, then turn it on while pressing and holding D.
When you see the screen asking you to choose your language do so, then watch as the progress bar indicates that your Mac is being assessed. This takes 2-3 minutes.


If problems are identified, Apple Diagnostics will suggest solutions.

Reset your SMC, PRAM or NVRAM

Reset the PRAM and the SMC (System Management Controller) is worth a try. This process is covered here: How to reset your Mac's NVRAM, PRAM, and SMC.

I suggest you try this step as a last option. 

However, flushing DNS should work if your network is working sometime then.