Upgrading to newer macOS is 100% dependant on the Age of the computer and what version of macOS it qualifies for. Apple Icon Desktop >> About this Mac will provided the needed informations. With Due diligence - check what macOS the computer can upgrade to. This page on Apple Site offers various older versions of macOS what what computers qualify for each version.
Once one has determined the version of macOS the computer can handle, Using Only Safari clink on the version desired. It will download the Full Installer and attempt to install / UpGrade. Suggest Quit the installer. Restart in Safe Mode - Shift key immediately at startup and without any external drives attached. Once logged in, run the installer