Hi!
Can someone please explain how this monster works?
If the value of A1 is "somenum1or2", it really returens a "1".
I wonder why..
With A1="somenum1or2", "1:"&LEN(A1) yields 11.
"1:"&LEN(A1) yields "1:11".
However: indirect("1:11") yields 0. And Row(indirect("1:11"))
yields 1. And Row(indirect("88:11")) yields 11. It seems, that
Row(indirect("x:y")) for some number x and y just yields the
lower one. Strange.
Yes, this is maybe the wrong approach to understand this formula,
because it is an array formula. I know a little bit of those.
But not enough to understand this monster. I only have a vague
idea:
I assume that the --MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1) creates
an array of all charakters in A1 by calculating MID(A1,x,1) for
all x from 1 to LEN(A1). ISNUMBER then maps these chars in TRUE/FALSE
values and the MATCH looks for the first TRUE value and returns its
index in the array. Finally, the MID returns just that char. Easy?!?
What I don't understand is: How does ROW(INDIRECT("1:"&LEN(A1)) return
an array of characters of the string in A1?
And what the hell does "--" mean / do?
Please enlight me...
KL wrote:
> Hi,
>
> Try this:
>
> =--MID(A1,MATCH(TRUE,ISNUMBER(--MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)),0),1)
>
> Regards,
> KL
>
>
> "xirx" <xirx@gmx.de> wrote in message
> news:429c3975$0$298$4d4ebb8e@read.news.de.uu.net...
>
>>Hi!
>>
>>The seach/3 function searches for 'find_text' in
>>'within_text', starting at the 'start_nun's character:
>>
>>SEARCH(find_text,within_text,start_num)
>>
>>I need to find the first digit in a string. I guess,
>>search/3 does neither support regular expresseions,
>>no does it allow a function instead of a constant
>>'search_text'.
>>
>>One way to find the first digit is this monster:
>>
>>=MIN(
>> IF(ISNUMBER(SEARCH(0;D2));SEARCH(0;D2);9999);
>> IF(ISNUMBER(SEARCH(1;D2));SEARCH(1;D2);9999);
>> IF(ISNUMBER(SEARCH(2;D2));SEARCH(2;D2);9999);
>> IF(ISNUMBER(SEARCH(3;D2));SEARCH(3;D2);9999);
>> IF(ISNUMBER(SEARCH(4;D2));SEARCH(4;D2);9999);
>> IF(ISNUMBER(SEARCH(5;D2));SEARCH(5;D2);9999);
>> IF(ISNUMBER(SEARCH(6;D2));SEARCH(6;D2);9999);
>> IF(ISNUMBER(SEARCH(7;D2));SEARCH(7;D2);9999);
>> IF(ISNUMBER(SEARCH(8;D2));SEARCH(8;D2);9999);
>> IF(ISNUMBER(SEARCH(9;D2));SEARCH(9;D2);9999)
>>)
>>
>>Any more efficient way to do a
>>
>>search('[0-9]';D2) or search(isnumber();D2)
>>
>>?
>
>
>
Bookmarks