You can use Index and match, but if you want a code, please attach your sample.