View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
4mula freak 4mula freak is offline
external usenet poster
 
Posts: 4
Default EXCEL: How to scan text reversed (like ACCESS: InStrRev)?

A very intriguing approach. Another day I must try again to implement it.
I know how to name lists or cells, so I think seq: is just one cell, with
the formula you gave. No variable in seq's formula, right? Why 1024?
And I know very well VLOOKUP, sometimes HLOOKUP, but never just LOOKUP.
Interesting function - Vector or Array, MS Help says. INDEX is like that,
too. Which way using LOOKUP here - Vector or Array?
I've used MID a lot, but rarely like this. We're seeking a Boolean
true/false value here (0, or 1), right? (I goofed on prelim effort, it
always comes out #DIV/0! even if x is in y. I must be making an error.)
Thanks for sharing this amazing alternative strategy. It is almost like
using formulas to build other formulas to feed the INDIRECT function. As you
granted, it's not so obvious. I like using higher level controls over lower
constructs.
As to note about oddity of design stemming from misusing what at root is
a financial program, by forcing it to do:
text manipulation and/or general list processing...

Yes, likely some truth to that. I would add there's a long history of doing
non-financial things. Excel predecessors Lotus, Visicalc, all had nearly
every text-oriented command very close to what BASIC had from early days
(Dartmouth). One thing none have is a FOR... NEXT recursion control loop.
None allow "circular ref", not counting something that might be possible
behind the scenes in VBA. Likely this also may be why odd ways to do job,
text or financial, sometimes is sought out.

"Harlan Grove" wrote:

"4mula_freak" wrote...
Immediate Purpose: To do a right-to-left scan in EXCEL formula operating
on another text field, similar to what's allowed in ACCESS query formula
with InStrRev function. . . .

....
A work-around is bulky: Make your own reversed text, then use normal
left-to-right FIND and offsset this against LENgth to get answer. . . .

....

And yet another way involves using a few defined names.

seq: =ROW(INDEX($1:$65536,1,1):INDEX($1:$65536,1024,1))

Then the rightmost position of the substring x in y would be given by

=LOOKUP(2,1/(MID(y,seq,LEN(x))=x),seq)

And if you want to use wildcards,

=LOOKUP(2,1/(SEARCH(x,MID(y,seq,LEN(y)))=1),seq)

Granted this isn't exactly obvious, but it works WITHOUT array entry or
volatile functions. But this is what you get when misusing a program
intended for numeric financial calculations for text manipulation and/or
general list processing.