Hi Tom
Thank you for that.
I had attempted using SMALL( ,5) first but came up with the position of
the first Capital. I suppose I must have had something wrong. That's
what led me to the rather long-winded attempt at finding the number of
Capitals and deducting from it to find the Largest. (My test cell was 20
characters long, with a 5th capital in position 16, and a 6th in
position 18)
Copying your version of SMALL() works absolutely fine.
On another point, I had also played around with reducing the formula
length, by using a technique which I first saw used by Harlan Grove. He
used a Named formula of
seq = ROW(INDIRECT("1:1024"))
The problem of course, using a large number like 1024 (or any number
greater than the length of the string being tested), is that CODE() of a
Null returns a #VALUE error.
I could not think of any way of limiting seq to the length of the string
concerned, whilst keeping the named formula as non-cell specific.
If you set the length to be "1:20" (my test cell size) then it works and
your formula would shorten to
=IF(A1="","",SMALL(IF((CODE(MID(A1,seq,1))<91)*(CODE(MID(A1,seq,1))>64),test),5))
and if the parameter of 5 were taken out to a cell e.g. $E$1, then even
with the test to ensure that there are the required number of capitals
to avoid the #NUM error, the formula becomes
=IF(SUM(((CODE(MID(A1,seq,1))<91))*((CODE(MID(A1,seq,1))>64)))<$E$1,"",IF(A1="","",SMALL(IF((CODE(MID(A1,seq,1))<91)*(CODE(MID(A1,seq,1))>64),seq),$E$1)))
What I wanted to ask you Tom, is there any way you can think of for
passing the length of the string to the named formula seq?
I can do it if I define scount = LEN(Offset(D1,0,-3)
and seq =ROW(INDIRECT("1:"&Scount))
but then it only works if you put the main formulae in column D, not in
any other column.
Have you any thoughts on this?