Announcement

Collapse
No announcement yet.

Using and/if formula to change text based on two criteria

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Using and/if formula to change text based on two criteria

    Afternoon all, I am relatively new to Revit and I am trying to find out a way of using the formula to determine duct part numbers. the issue I have is that the family covers 3 sizes and two bend angles. Can the and/if statements be expanded to cover 6 options or is there a better option?

    it is currently;

    =if(Duct Diameter = 10mm, if(Angle = 90°, "10mm 90°", if(Angle = 45°, "10mm 45° Bend", "Unknown Part")), "Unknown Part")

    any advice would be greatly appreciated.

    #2
    Nested if statements can contain a number of options. I'd write what you have like this:

    if(and(Duct Diameter=10mm, Angle = 90°), "10mm 90°", if(and(Duct Diameter=10mm, Angle = 45°), "10mm 45° Bend", "Unknown Part"))

    What you are doing is starting another if statement as the <result if false>. At the end of the string of if statements you have your result if none of them are true (in this case
    "Unknown Part"). You need to end the string with one close parentheses for every if statement, so if you add another 4 statements you'll close the formula with 6 parentheses.
    Julie Kidder
    Architect + BIM Director
    Hartman + Majewski Design Group

    Comment


      #3
      Hi jmk, thanks for your response, so if I understand you correctly (and forgive me if i'm well out of the ball-park!) to achieve the following "look-up" table result...
      size 90 45
      10mm A B
      20mm C D
      30mm E F
      I would need to write something like...

      if(and(Duct Diameter=10mm, Angle = 90°), "A", if(and(Duct Diameter=10mm, Angle = 45°), "B", if(and(Duct Diameter=20mm, Angle = 90°), "C", if(and(Duct Diameter=20mm, Angle = 45°), "D" , if(and(Duct Diameter=30mm, Angle = 90°), "E", if(and(Duct Diameter=30mm, Angle = 45°), "F", "Unknown Part"))))))

      Comment


        #4
        Looks like you need an actual lookup table. Have you tried that?
        There must be a better way...

        Ekko Nap
        Professional nitpicker, architect, revit consultant, etc.

        Comment


          #5
          Originally posted by Titon View Post
          Hi jmk, thanks for your response, so if I understand you correctly (and forgive me if i'm well out of the ball-park!) to achieve the following "look-up" table result...
          size 90 45
          10mm A B
          20mm C D
          30mm E F
          I would need to write something like...

          if(and(Duct Diameter=10mm, Angle = 90°), "A", if(and(Duct Diameter=10mm, Angle = 45°), "B", if(and(Duct Diameter=20mm, Angle = 90°), "C", if(and(Duct Diameter=20mm, Angle = 45°), "D" , if(and(Duct Diameter=30mm, Angle = 90°), "E", if(and(Duct Diameter=30mm, Angle = 45°), "F", "Unknown Part"))))))

          Yes,that should work. I haven't experimented with the lookup tables ekkonap mentions, so I can't say how they'd compare.
          Julie Kidder
          Architect + BIM Director
          Hartman + Majewski Design Group

          Comment


            #6
            Originally posted by jmk View Post
            Yes,that should work. I haven't experimented with the lookup tables ekkonap mentions, so I can't say how they'd compare.
            It worked, thanks all for your guidance

            Comment

            Loading...
            Working...
            X