For instance H1=12345678
Creating a list of 1-7 digits from the right: {12345678,1234567,123456,12345,1234,123,12}
INT($H$1*10^-{0,1,2,3,4,5,6})
Check with COUNTIF to figure out where in A2:G4 meets any of above list:
COUNTIF($A$2:$G$4,INT($H$1*10^-{0,1,2,3,4,5,6}))
and position:
MATCH(1,COUNTIF($A$2:$G$4,INT($H$1*10^-{0,1,2,3,4,5,6})),0)
Finally with INDEX to show the first match from the right columns:
=INDEX(INT($H$1*10^-{0,1,2,3,4,5,6}),MATCH(1,COUNTIF($A$2:$G$4,INT($H$1*10^-{0,1,2,3,4,5,6})),0))
File attached
Not sure it meets yours, but this may be a start.
Bookmarks