Excellant Mark!!! this is exactly what I have been looking for. Thank you so much!!!
Hi Rocky,
Happy to be of what help I could be, but I sure hope you spot this later and try Rick's. It is about 2.4 times faster!
I hope you will not mind me poking in a bit of a question to the others, but it is always nice when an opportunity to understand something a bit better presents itself.
All ya'll,
Reference the formula solutions:
Okay - I knew there'd be a better way, but what a trouncing! Ow, ow, ouch! (I think I have permanent scarring)
Seriously, I wanted to take a moment to thank you all. While of course the answers are for the OP, formulas are more a mystery for me than code, and this (Aladin's, Biff's, and Rick's ansers) was a nice chance to maybe get a better grasp...
If one of you would not mind, I would like to confirm (or be corrected as to) my understanding as to the steps of, in this case, Aladin's formula.
Let us say that A2 contains 'Test5123' as its value/text.
To return the number portion (as a string), Mr. Akyurek uses:
Code:
=REPLACE(A2,1,MIN(FIND({0,1,2,3,4,5,6,7,8,9},A2&"0123456789"))-1,"")
Now at the core of the formula is:
Code:
=FIND({0,1,2,3,4,5,6,7,8,9},A2&"0123456789")
For reasons I do not totally understand, no CSE confirmation is needed, but this, given our test value, returns an array of:
Code:
{9,6,7,8,13,5,15,16,17,18}
I believe I do understand the return array, as first, we look for '0', which in this case, will be at position 9, the first character in the appended string.
Is my thinking is correct, in that we include the appended string really only to prevent errors from searching for characters that do not exist?
From there, 6 is returned next, as '1' is found at position 6 and so on...
Now, MIN() can return a value, for as mentioned, it will not be finding any errors in the array returned by FIND(), due to the appended number string. Thus, MIN() returns the first position of a (any) number in the test value.
From there, the formula uses the result of MIN()-1 to instruct how many characters are to be replaced with an empty string.
Presuming that is all correct,
is there any type of general rule or logic as to when we need to enter (a single cell formula) via CSE?
I hope all that was sensible, and again, thank you
Mark