Help

Re: How to set a date based on a single-select field

949 2
cancel
Showing results for 
Search instead for 
Did you mean: 
imomarsx
4 - Data Explorer
4 - Data Explorer

I am trying to create a payment due date based on adding days (either 15 or 30) depending on what kind of vendor type is selected. Both 'if' parts of the formula work if I place them in separate formula fields but I would like this to all come through on the same column so I can see 'payment due date' in one place - anyone able to help?

IF({Vendor Type (from Vendor) 2}=“Independent Contractor”,
  DATEADD(Created,3,‘days’),IF(
  {Vendor Type (from Vendor) 2}=“Included in Payroll/TEAMs”,
  DATEADD(Created,5,‘days’))

3 Replies 3

Hey @imomarsx,

You just needed to tweak your parentheses and sequencing a bit, but overall a pretty easy fix.
Try this:

IF(
  {Vendor Type (from Vendor) 2} = "Independent Contractor",
  DATEADD(
    {Created}, 3 , "days"
  ),
  IF(
    {Vendor Type (from Vendor) 2} = "Included in Payroll/TEAMs",
    DATEADD(
      {Created}, 5, "days"
    )
  )
)

 

This is a huge help thank you!! And if I want the first option to be either "Independent Contractor" or "Company" what would the best syntax be here? Apologies for the probably stupid question.

Nah, not stupid at all!
You can accomplish this by implementing the OR() function, specifically:

OR(
  {Vendor Type (from Vendor) 2} = "Independent Contractor",
  {Vendor Type (from Vendor) 2} = "Company"
)

Here's the full formula:

IF(
  OR(
    {Vendor Type (from Vendor) 2} = "Independent Contractor",
    {Vendor Type (from Vendor) 2} = "Company"
  ),
  DATEADD(
    {Created}, 3 , "days"
  ),
  IF(
    {Vendor Type (from Vendor) 2} = "Included in Payroll/TEAMs",
    DATEADD(
      {Created}, 5, "days"
    )
  )
)