# Average IF Formula

I have a column (Completion Date) and a column (Approved Budget).

I am trying to find the Average Approved Budget for 2021.

This formula works for budgets after 2021.

=AVERAGEIF([Completion Date]:[Completion Date], >DATE(2021, 1, 1), [Approved Budget]:[Approved Budget])

But, I cannot figure out how to get the formula to work between 01/01/2021 and 12/31/2021.

This is what I was trying to use:

=AVERAGEIF([Completion Date]:[Completion Date], AND(>DATE(2021, 1, 1), (<DATE(2021, 12, 31))), [Approved Budget]:[Approved Budget])

But I get the #InvalidOperation Error

HELP!!!!!

• ✭✭✭✭✭
```=AVG(COLLECT(
[Approved Budget]:[Approved Budget],
[Completion Date]:[Completion Date], AND(
@cell >= DATE(2021, 1, 1),
@cell <= DATE(2021, 12, 31))))
```

Can you please try this one

...

• ✭✭✭✭✭✭

I would probably opt for using an AVG(COLLECT formula instead. Try this:

=AVG(COLLECT([Approved Budget]:[Approved Budget], [Completion Date]:[Completion Date], >DATE(2021, 1, 1), [Completion Date]:[Completion Date], <DATE(2021, 12, 31)))

Hope this helps!:)

• ✭✭✭✭✭
```=AVG(COLLECT(
[Approved Budget]:[Approved Budget],
[Completion Date]:[Completion Date], AND(
@cell >= DATE(2021, 1, 1),
@cell <= DATE(2021, 12, 31))))
```

Can you please try this one

...

• ✭✭✭✭✭✭

I would probably opt for using an AVG(COLLECT formula instead. Try this:

=AVG(COLLECT([Approved Budget]:[Approved Budget], [Completion Date]:[Completion Date], >DATE(2021, 1, 1), [Completion Date]:[Completion Date], <DATE(2021, 12, 31)))

Hope this helps!:)

• Thanks to both of you these worked!!!!

## Help Article Resources

Want to practice working with formulas directly in Smartsheet?

Check out the Formula Handbook template!