Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function iftrue(Fx, condition, show)
- iftrue = Application.WorksheetFunction.if(Fx & condition, show, Fx)
- End Function
- Function testsum(a, b)
- test = Application.WorksheetFunction.Sum(a, b)
- End Function
- Function testif(a, b, c)
- testif = Application.WorksheetFunction.if(a, b, c)
- End Function
- =Application.WorksheetFunction.Sum(Range("A1"),Range("A2")) = Range("A3").Value
- Function IFTrue(fx, condition As String, show)
- Dim tst As Boolean
- Dim z As Integer
- Dim t As String
- 'test whether the condition is assuming "="
- If InStr("<>=", Left(condition, 1)) = 0 Then condition = "=" & condition
- 'Find whether there is one or two qulifiers
- If InStr("<>=", Mid(condition, 2, 1)) > 0 Then z = 2 Else z = 1
- 'Parse string to remove qulifiers from the quotes and make everything a string
- t = """" & fx & """" & Left(condition, z) & """" & Mid(condition, z + 1) & """"
- 'evaluate the formula string to resolve to True or False
- tst = Application.Caller.Parent.Evaluate(t)
- If tst Then
- IFTrue = show
- Else
- IFTrue = fx
- End If
- End Function
- =IFtrue(SUM(A1,A2),"=A3","Must Be True")
Advertisement
Add Comment
Please, Sign In to add comment