Forum Discussion

JamesTrory's avatar
JamesTrory
Qrew Assistant Captain
7 years ago

WeekdayAdd used with IF function

Hi,

I'm using the below formula in a field called [Due in OTMM] to return the date of the field [To MRC] with the addition of 5 business days:

WeekdayAdd(ToDate([To MRC]),5)

But what I'd really like it to do is create a series of IF functions in [Due in OTMM] so that different dates in this field can be displayed depending on the results of other fields. For example:

If (
[To MRC]>[From MRC],WeekdayAdd(ToDate([To MRC]),5),
[To OTMM]>[Date Imported],WeekdayAdd(ToDate([To OTMM]),2),
"")

The above would ideally return two different results, either:

  1. Five days added to [To MRC] but only if the date in [To MRC] is greater than in [From MRC]

    OR if that isn't true

  2. Two days added to [To OTMM] only if the date in [To OTMM] is greater than [Date Imported].
I will probably want to add a few others in as well.

Unfortunately this returns the error "The types of the arguments or the number of arguments supplied do not meet the requirements of the function If". I've tried Case and that doesn't work either. Is there a way to use WeekdayAdd with the IF function, or do I just have the formula wrong?

2 Replies

  • you wwre super close.  se nhow you are saying to make a text empty field at the end?

    ,"")

    well this is a date field so text is not allowed even empty text.

    so use either null or else just be silent.



    If (
    [To MRC]>[From MRC],WeekdayAdd(ToDate([To MRC]),5),
    [To OTMM]>[Date Imported],WeekdayAdd(ToDate([To OTMM]),2),
    "")

    so either thois

    If (
    [To MRC]>[From MRC],WeekdayAdd(ToDate([To MRC]),5),
    [To OTMM]>[Date Imported],WeekdayAdd(ToDate([To OTMM]),2), null)

    or else

    If (
    [To MRC]>[From MRC],WeekdayAdd(ToDate([To MRC]),5),
    [To OTMM]>[Date Imported],WeekdayAdd(ToDate([To OTMM]),2))
  • JamesTrory's avatar
    JamesTrory
    Qrew Assistant Captain
    Ahhh, yes of course! Perfect, thanks. It seems to be working now.