My macbook air mid 2011 no longer connects to 5g WiFi My Macbook Air 2011 could connect to a 5g wifi network before but now, my Macbook won't connect and it showed an error message that says could not join wifi network. The wifi network worked fine for other devices eg. my phone and my MacBook could connect to the same wifi before. My operating system is macOS 10.13.6. I would appreciate it if there would be a fix to that.
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.