View Single Post
  #18   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Rick Rothstein \(MVP - VB\) Rick Rothstein \(MVP - VB\) is offline
external usenet poster
 
Posts: 2,202
Default adding numbers with letters

In line....

A problem with the malformations is that we don't really know how to interpret
it. I took the point of view that the "/" needed to be part of a fraction, so
I could test to make sure it was surrounded by digits. The same is true of the
".". But maybe a standalone "/" should be interpreted as a "divide" operator.
What about other standalone possible operators?

I also make the assumption that a "-" is a negation or subtraction, even if it
stands alone. But for consistency with your routine, I did not make that
assumption with the "/"


Yes, there is no way of knowing what the OP wanted given the original posting. My guess from what he posted was that he only needed to handle addition; but I figured it was easy enough to add subtraction to the routine I came up with that I included it too. Part of the reason for doing that is my experience with too many postings asking a question and then, after providing a solution, having the OP come back and tell us that was just a simplified example, here is what I actually need (why do so many posters do that anyway?).

Anyway, it's an interesting exercise.


Yes, for sure. And your posted solution is probably going to make me dig out my Regular Expression books (I know, I said that last time, didn't I?) and try relearn them. If I remember correctly, you said the Regular Expression implementation from VBScript is what you use.

Rick