Alex Campbell
asked on
How to turn this IF statement into a UDF?
While I know this is a simple IF statement, I am learning UDFs so I wanted to see how it is done in this case.
In the attached worksheet, this is the formula for the first row:
=IF(G3="N",A3&"-"&B3&"-"&C 3,D3&"."&E 3)
Options.xlsx
In the attached worksheet, this is the formula for the first row:
=IF(G3="N",A3&"-"&B3&"-"&C
Options.xlsx
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Perhaps.
Function MyJoinUDF(rng As Range) As String
If rng.Value = "N" Then
MyJoinUDF = Join(Application.Transpose(Application.Transpose(rng.Offset(, -6).Resize(, 3).Value)), "-")
Else
MyJoinUDF = rng.Offset(, -3).Value & "." & rng.Offset(, -2).Value
End If
End Function
Here is an article of mine that you might find useful.
ASKER
Great. Thanks
Open in new window