Concatonate - formula too long
A simple Function is much easier to work with the a very long formula. They
are also easier to debug and easier to write. You can call the function with
your parameters. try it, your will like it.
Excel spreadsheet call (looks like the standarrd functtions)
=MyFunction (E3, F3, G3, H3, I3)
In VBA where the return value is Myfunction (the function name)
Function Myfunction( Parm1, Parm2, Parm3, Parm4, Parm5)
Myfunction = False
if( Parm1 = Parm2) then
Myfunction = true
end if
End Function
Here is one a wrote tthis morning
Function FindLast(ShortString, LongString) As Integer
Shortlength = Len(ShortString)
LongLength = Len(LongString)
FindLast = 0
If (Shortlength <= LongLength) Then
StringPosition = LongLength - Shortlength + 1
For i = StringPosition To 1 Step -1
If (StrComp(ShortString, Left(Mid(LongString, i, Shortlength),
Shortlength)) = 0) Then
FindLast = i
Exit For
End If
Next i
End If
End Function
"Foo2U" wrote:
I have a cell that populates by determining if the columns next to it have an
"X" entered. If they do, the name of the column is concatenated to the
current text, followed by a comma. If there is no "X", no text is added. I
use the formula below:
=CONCATENATE(IF(E3="X",$E$2&", ","")&IF(F3="X",$F$2&",
","")&IF(G3="X",$G$2&", ","")&IF(H3="X",$H$2&", ","")&IF(I3="X",$I$2&",
","")&IF(J3="X",$J$2&", ","")& etc...
This has woked fine for awhile, but now we have too many columns and the
formula is too long.
Any suggestions on how to make this work with a shorter formula?
Thanks in advance.
|