IF AND In Between Formula

I'm attempting to mark whether a sale is valid based on the following criteria:

  1. Clinic must have had an AHHI-1 or AHNN-1 tracking code and
  2. Invoiced Date on the sale must be between the Start and End Date of the event.

I've tried this multiple different ways but keep getting errors. Here is what I have:

=IF(AND([Clinic ID]@row = {Clinic ID}, [Invoiced Date]@row >= {Start Date}, [Invoiced Date]@row <= {End Date}, OR({Code} = "AHHI-1", {Code} = "AHNN-1"), 1, 0))

Validation Sheet

Event Tracking Sheet

Best Answer

  • Paul Newcome
    Paul Newcome ✭✭✭✭✭✭
    Answer ✓

    Ok. 2 things… I see the issue here, and I have a suggestion / tip for other headaches.

    The issue here… When you manually type in a number, it is stored as numerical data. When you use a LEFT function, it is stored as text data. While they may look the same (aside from left vs right justified in the cell which is what led me here), they are stored on the back-end as two different data types.

    Try wrapping the whole LEFT formula in a VALUE function. That should clear up the most immediate issue.

    =VALUE(LEFT(……………….), 4))

    Now for the tip: VLOOKUP is terrible. INDEX/MATCH is so much better in so many ways.

    =INDEX({Single Column To Pull Over}, MATCH([Column Name]@row, {Single Column To Match In}, 0))

Answers

Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!