Forum Discussion

ReeceReece's avatar
ReeceReece
Qrew Trainee
6 years ago

If AND Formula help

Need help with this If and formula. The error is stating that there aren't enough arguments to support the function. 


IF(AND([FOX NTV]>[Client NTV],(((([FOX NTV]-[Client NTV])/30)*[Base Rent] )>[Vacancy]),
OR(ISPICKVAL([RQ Lease Terms],"Month to Month"), ISPICKVAL([RQ Lease Terms],"Subject to Extension"))),

(((([FOX NTV]-[Client NTV])/30)[Base Rent])-[Vacancy]+((([Client Lease Start Date]-[FOX Lease 1 Start Date])/30)[Base Rent])),

IF(AND([FOX NTV]>[Client NTV],[FOX NTV]>[Client LOS],(((([FOX NTV]-[Client LOS])/30)*[Base Rent])>[Vacancy]),OR(ISPICKVAL([RQ Lease Terms],"Length of Stay"),ISPICKVAL([RQ Lease Terms],"Firm Departure Date"))),

(((([FOX NTV]-[Client LOS])/30)*[Base Rent])-[Vacancy]),


NULL))
  • AustinK's avatar
    AustinK
    Qrew Commander
    The core of what you need is simple. You need the comparison(1 = 1), a true and a false.

    If(
    1 = 1, True,
    False
    )

    If you have multiple lines they still need the same format. The "1 = 5, True," is the first part and the false is the next line saying 1=4 which it will see is not a False and actually another thing to compare. So it moves down the if statement in that way. I wish I could make a nice gif for this. 

    If(
    1 = 5, True,
    1 = 4, True,
    1 = 3, True,
    1 = 2, True,
    False
    )

    Looking at your formula.. I think there are many issues with this. It is so hard to tell because it is spaghettied so hard.

    For example look at the second group of text. It begins with a part that makes no sense. "((([FOX NTV]-[Client NTV])/30)[Base Rent])" that is clearly missing something. Walk through it, you are subtracting [FOX NTV] from [Client NTV] then dividing that by 30 and then randomly throwing another field next to it with no operator. It is also in the second half of that line. From the other lines it looks like it is missing an asterisk.

    I'm not sure what the point of doing "If(AND" is either, I don't think it is doing anything when you put an and right at the beginning like that. 
  • Hey! It was previously coded like that outside of quickbase minus the asterisk missing in the one line. 

    If I do your format and get rid of the (AND, I run into more errors with the entire formula. 

    • AustinK's avatar
      AustinK
      Qrew Commander
      The errors you see will keep populating one by one until the entire thing is correct. You might have an error showing on one part that is caused by another section of the formula. QuickBase does not always do a great job explaining where the errors are.

      I don't think you will be able to just remove those and have it work anyway as you said it was not functional before.

      ISPICKVAL Is not a function in QuickBase, at least not a listed one.

      You are likely going to have to just start over and use that formula as a guide when making the new one. You can try to edit the code you have but seeing as it isn't even originally from or for QuickBase that is probably going to be a nightmare.

      Edit: I see now, this is a Salesforce formula. Right?
    • ReeceReece's avatar
      ReeceReece
      Qrew Trainee
      Yes Salesforce!

      Anyways I've been breaking it down and now have the error with the + sign. "the operator + can't be applied on types number duration" I know this has to do with the duration of stays, but that is a number value
  • In quick base, put the and in between each condition you would like to combine for evaluation; i.e. If( condition1 and condition2, result