I agree with AnkleWork's suggestions and would additionally suggest that you disconnect the wire from the derailleur, keep tension in it and work the shifter to determine if it dependably and consistently feeds out and takes up the wire. Maybe clean and lube the shifter too.
It would be easy and not too expensive to just replace the wire and housings, which are wear items and could also be dirty, might make a huge improvement and would give you a chance to set up the shifting ab initio.