Question

I have 2 sheets

Sheet A

Column A          Column B                           Column C

From                To                  Avg. Forex Rate between these 2 dates

1 April 2013       25 June 2013

26 June 2013       27 July 2013

29 Ocotober 2013   31 March 2013

Sheet B-Exchange Rates during the year

   Column A          Column B
Date         Exchange Rate
1 April          60.2
2 April          63.5
3 April          64.5
.
.
.
31st March       60.1

I am trying to find out the Average Exchange rates between 2 dates(as in Sheet A) using the Averageif formula

The formula I am Applying is

=AVERAGEIF('Sheet B'!A1:A365,AND(">B1","<C1"),'Sheet B'!B1:B365)

However,I get the #DIV/0! Error.

After much research and troubleshooting I found out,that even if i Don't use the AND function in the above forumula I still get the #DIV/0! Error.

After some more research I found out,that

If we give a Cell reference in the formula Averageif ,i.e. ">B1" ,we get the error.

If we put a manual number, i.e. ">41365" we do not get the error.

Is this a known bug?

Was it helpful?

Solution

I'm pretty sure this is done by design and is not a bug. A cell reference inside a string will not evaluate literally. One way to get around this would be to write as

">"&B1

I think you're also going to have issues using the AND function with the second argument. Instead, use AVERAGEIFS which allows you to use multiple conditions for determining whether values should be included in the average. So your formula would be something like

=AVERAGEIFS('Sheet B'!B1:B365,'Sheet B'!A1:A365,">"&B1,'Sheet B'!A1:A365,"<"&C1)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top