The place to begin with all questions like this one is to ask how can it be done using Excel? When you know the answer to that question, you can look to emulate the same process using POI. Last night, I tried to do this with Excel itself and do not believe that it is possible using just the forumla support.
The first part is very easy as Excel contains a LEN() function which returns the length of either the text placed between the paraentheses or the contents of a cell. Therefore LEN(B1) where cell B1 contains the string 'Test', would return 4. The first bit of the second part is also very easy becasue Excel efines an IF() function that looks like this - IF(Logical Expression, Do If True, Do If False). Combining the LEN() and IF() functions gets us so far - IF(LEN(B1) <= A1, LEN(B1, ......) - which would be entered into cell C1 and says, simply, if the length of the contents of cell B1 is less than or equal to the value of cell A1 then set the value of C1 to the legth of B1 else......, and that is the hard bit. As far as I can see, there is no way to create a Message Box using any of the available funtions/forumlae. I think that you will need to find an Excel forum and post a similar question there. Leave out any mention of POI and ask, simply, how to achieve what you are after using Excel. Macros will be the answer I suspect and, if this is the case, then you will find macros cannot be created or edited using POI. Yours Mark B -- View this message in context: http://apache-poi.1045710.n5.nabble.com/Formula-Support-in-Apache-POI-tp3374589p3375526.html Sent from the POI - User mailing list archive at Nabble.com. --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
