This is quite easy to do using Excel's LOOKUP function or combined INDEX/MATCH functions. See, for example:
https://www.msofficeforums.com/excel...ting-data.html. No programming required.
PS: I've merged your two threads as both issues can be handled in much the same way.