View Full Version : 2016 How do I use IF ???
davem82
2016-05-10, 01:54 AM
I am trying to create a Calulated Value that will read if 1 of 4 yes/no boxes have been ticked and give a response back on that total.
This works for reading 1 check box
if( DMTypeA, 0.5, 0)
but I want it to read read 3 more check boxes
I tried
if( DMTypeA, 0.5, 0) or(if( DMTypeB, 1.0, 0)) or(if( DMTypeC, 1.2, 0)) or(if( DMTypeD, 3.5, 0))
but doesn't work, any help would be great.
Craig_L
2016-05-10, 11:24 AM
sounds like an if-then-else statement to me..
' Multiple-line syntax:
If condition [ Then ]
[ statements ]
[ ElseIf elseifcondition [ Then ]
[ elseifstatements ] ]
[ Else
[ elsestatements ] ]
End If
' Single-line syntax:
If condition Then [ statements ] [ Else [ elsestatements ] ]
Steve_Stafford
2016-05-10, 03:25 PM
...if( DMTypeA, 0.5, 0) or(if( DMTypeB, 1.0, 0)) or(if( DMTypeC, 1.2, 0)) or(if( DMTypeD, 3.5, 0))...
Revit's syntax for IF OR is:
IF ( OR ( x = 1 , y = 2 ) , <true>, <false>)
Returns <true> if either x=1 or y=2, else <false>
What do you want to happen if different combinations of Check Boxes are checked?
THIS thread at RFO (http://www.revitforum.org/tutorials-tips-tricks/1046-revit-formulas-everyday-usage-36.html) is a good resource for formulas, go to the very first post.
Alex Page
2016-05-13, 02:44 AM
So, with your example, it should look more like this:
if( DMTypeA, 0.5, if( DMTypeB, 1.0, if( DMTypeC, 1.2, if( DMTypeD, 3.5, 0))))
So that would mean if typea, b, c and d are unticked, then the result would be "0"
but it is also dependant on the order...so if TypeA was ticked the result would be 0.5 and it wouldnt look any further.....
so, the use of OR and AND will probably be required depending on results expected
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.