View Single Post
  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
joeu2004 joeu2004 is offline
external usenet poster
 
Posts: 2,059
Default Using Formulae in If statements

On Mar 1, 12:27*pm, "Tazzy via OfficeKB.com" <u26845@uwe wrote:
Thank you for taking the time to give a constructive answer
to my question. Had I wished to ramble on for ages, then I
could have explained at length why the formula had to in a
certain format


I presume you are alluding to my response, and you are implying that
it was not constructive.

On the contrary, it was my intent for it to be constructive. I was
trying to show you the complexity of the problem and why, at the very
least, there cannot be any "formulae" that could solve your problem,
if by that you meant something other than a VB UDF.

Even Rick's attempt to exhaustively test for some of the possible
student formulas that I suggested is not adequate, IMHO, even if it
worked. (Note: Rick's sub returns "correct" if the target cell has
no formula. I think that defect can be fixed easily.) It fails to
account for variable whitespace, which is not unreasonable to expect.

Ideally, we would use a function that accepts regular expressions. I
presume there is none, even in the Windows API, because a google
search reveals solutions offered for a price. In the absence of
RegExp function, I would write a parser. Even then, I think you would
have to limit the possible student formulas arbitrarily.

Arguably, you could express the problem to the student as follows:
``Write a formula in F3 that uses "<" to compare the sum of D2 and D3,
in that order, with E3 and return "URGENT" if true and "" if false.
Do not include any extra spaces in your formula. Use relative
references, and copy the formula into F4 through F10.``

Yeah, I guess that would "explain at length why the formula had to in
a certain format" ;-).

Sorry if that is not the simplistic solution you wanted, and you
consider anything to be "non-constructive".