"Arithmetic expression does not have valid input types"

Hello!
I am a new AppSheet user and Iโ€™m hoping someone can help me out with my formula

Basically I have an Excel formula that AppSheet couldnโ€™t recognize, so Iโ€™m trying to tweak it under App Formula for it to work.

Sample Excel Formula: =IF(ISBLANK(A1),โ€œPending Submissionโ€,IF(AND(A1-TODAY()<=14,A1-TODAY()>0),CONCAT(โ€œExpiring Very Soon - โ€œ,A1-TODAY(),โ€ daysโ€),IF(AND(A1-TODAY()<=60,A1-TODAY()>0),CONCAT(โ€œExpiring Soon - โ€œ,A1-TODAY(),โ€ daysโ€),IF(A1-TODAY()<=0,โ€œExpiredโ€,โ€œValidโ€))))

In AppSheet, I have the columns [Expiry Date] (with a date column data type) and [Expiry Status] (with a text column data type), so Iโ€™m editing the formula under [Expiry Status] and my goal is for the formula to return the values โ€œPending Submissionโ€, โ€œExpiring Soon - ___ daysโ€, โ€œExpiring Very Soon - ___ daysโ€, โ€œExpiredโ€ or โ€œValidโ€.

My AppSheet formula is:

IFS(
(ISBLANK([Expiry Date])),
โ€œPending Submissionโ€,
(AND([Expiry Date] - TODAY() <= 60,[Expiry Date] - TODAY() > 0)),
CONCATENATE(โ€œExpiring Soon - โ€œ,[Expiry Date] - TODAY(),โ€ daysโ€),
(AND([Expiry Date] - TODAY() <= 14,[Expiry Date] - TODAY() > 0)),
CONCATENATE(โ€œExpiring Very Soon - โ€œ,[Expiry Date] - TODAY(),โ€ daysโ€),
([Expiry Date] - TODAY() <= 0),
โ€œExpiredโ€,โ€œValidโ€
)

Iโ€™m not entirely sure if I got everything else correct, but the recurring error for the formula above is โ€œArithmetic expression โ€˜(([Expiry Date]-TODAY()) <= 60)โ€™ does not have valid input types.โ€

Iโ€™ve tried looking into other articles and questions within the community to look for answers but I havenโ€™t had any luck. However, if anyone has any leads on certain guides or articles that I may have overlooked, please let me know so I can check them out and learn more

Thank you so much!

0 8 1,859
8 REPLIES 8

Steve
Platinum 4
Platinum 4

Steve
Platinum 4
Platinum 4

Hereโ€™s your expression, reformatted for clarity:

IFS(
  (
    ISBLANK([Expiry Date])
  ),
    โ€œPending Submissionโ€,
  (
    AND(
      [Expiry Date] - TODAY() <= 60,
      [Expiry Date] - TODAY() <= 0
    )
  ),
    CONCATENATE(
      โ€œExpiring Soon - โ€œ,
      [Expiry Date] - TODAY(),
      โ€ daysโ€
    ),
  (
    AND(
      [Expiry Date] - TODAY() <= 14,
      [Expiry Date] - TODAY() > 0
    )
  ),
    CONCATENATE(
      โ€œExpiring Very Soon - โ€œ,
      [Expiry Date] - TODAY(),
      โ€ daysโ€
    ),
  (
    [Expiry Date] - TODAY() <= 0
  ),
    โ€œExpiredโ€,
  โ€œValidโ€
)

Youโ€™re missing a condition expression before the last argument, which makes the entire expression invalid. Youโ€™ve also got some extra parentheses, but thatโ€™s just aesthetic. With some tweaks:

IFS(
  ISBLANK([Expiry Date]),
    โ€œPending Submissionโ€,
  AND(
    [Expiry Date] - TODAY() <= 60,
    [Expiry Date] - TODAY() <= 0
  ),
    CONCATENATE(
      โ€œExpiring Soon - โ€œ,
      [Expiry Date] - TODAY(),
      โ€ daysโ€
    ),
  AND(
    [Expiry Date] - TODAY() <= 14,
    [Expiry Date] - TODAY() > 0
  ),
    CONCATENATE(
      โ€œExpiring Very Soon - โ€œ,
      [Expiry Date] - TODAY(),
      โ€ daysโ€
    ),
  [Expiry Date] - TODAY() <= 0,
    โ€œExpiredโ€,
  TRUE,
    โ€œValidโ€
)

This subexpression looks off:

AND(
  [Expiry Date] - TODAY() <= 60,
  [Expiry Date] - TODAY() <= 0
),

If [Expiry Date] is both less or equal to 0 days and less than or equal to 60 days?

Hi Steve,

Thanks so much for helping me out with the format and the correction at the end! Thank you for the reference to Date and Time Expressions too, will look into it.

Sorry about that, itโ€™s [Expiry Date] - TODAY() > 0

However, I still got the same error: โ€œArithmetic expression โ€˜(([Expiry Date]-TODAY()) <= 60)โ€™ does not have valid input types.โ€

Should I do anything about 60, or is it understood by the system that 60 means 60 days?

Is the Expiry Date column of type Date?

Steve
Platinum 4
Platinum 4

Subtracting a Date from a Date produces a Duration value, which is not a single value. Please read the doc I shared above. If that doesnโ€™t give you enough to work from, let us know.

Hi @Steve
Also struggling with something similar, can you see something Iโ€™m doing wrong here?

=IFS([Effective Date]<today(),โ€œAlready in effectโ€,[Effective Date]-TODAY()<=365,โ€œ1. Highly imminent: <12 Monthsโ€,(AND([Effective Date]-TODAY()>=365,[Effective Date]-today()<(365+(365/2)))),โ€œ2. Moderately imminent: <18 Monthsโ€,(AND([Effective Date]-TODAY()>=(365+(365/2)),[Effective Date]-today()<=(3652))),โ€œ3. Less imminent: <24 monthsโ€,[Effective Date]-TODAY()>(3652),โ€œEffective date >2 yearsโ€)

This expression:

([Effective Date]-TODAY())

appears to be subtracting one date (TODAY()) from another ([Effective Date]). The result of this will be a Duration value. A Duration value cannot be directly compared to a Number value as youโ€™re attempting:

(([Effective Date]-TODAY()) <= 365)

Instead, youโ€™ll need to convert the Duration to a Number (easy) or the Number to a Duration (not easy).

To convert a Duration to a Number of days, then compare to a Number of days:

((HOUR([Effective Date]-TODAY()) / 24) <= 365)

See also:



Thank you, @Steve

Top Labels in this Space