Please do try these troubleshooting steps that may help.
- First is to uninstall/reinstall the keyboard driver.
- Go to Device Manager and uninstall the keyboard driver.
- Once uninstalled, reboot your laptop and it should reinstall the driver automatically.
- Do test it again after the reboot.
- If it will still not work connect an external USB keyboard and see if it will work or not.
- If you don't have a USB keyboard do try using the onscreen keyboard and see if it will work or not.
- If the onscreen keyboard or the USB keyboard will work that could mean that the problem is the built in keyboard.
- Before replacing it do check the ribbon cable that connects the keyboard to the motherboard.
- If all these will not work then replacing the keyboard would be the only option.