Well, I still don't know what you want to end up with, but if you put
those numbers in, say, A1:A5 and put 347 in D1, then you can put this
formula in B1:
=SUMPRODUCT(--(ISNUMBER(SEARCH(MID(A1,ROW(A$1:A$4),1),""&D$1))))
and copy it down to B5 and you will have this:
1234 2 347
2347 3
8134 2
8247 2
5743 3
Then I suppose you could sort A1:B5 using column B in descending order
and column A in ascending order to get this:
2347 3
5743 3
1234 2
8134 2
8247 2
Is that what you had in mind?
Hope this helps.
Pete