Function for finding the number based on row selection