Finding Previous Date in Date Range With Duplicate Dates

K

Karl Burrows

I have a small worksheet that tracks sales by date and price. I have an
array formula that looks through the date ranges (Start Date and End Date)
to find the range that occurs in this period (current month) and then looks
to the previous period to get the variance. Here's a sample formula:

{=SUM(IF(($G$2>=BOP!$B$29:$B$71)*($G$3<=BOP!$C$29:$C$71),OFFSET(BOP!$J$29:$J
$71,-1,0),""))}

The problem I am running into is that is where 2 consecutive periods are the
same (where we had a pricing change in the middle of the date range, so we
showed 2 consecutive periods with different pricing), the Array adds both
OFFSET together.

Beg Date End Date Unit $ Units YTD Sales
Jan 1 Mar 1 $3.50 10 $50.00
Mar 1 Jun 1 $3.50 7 $75.00
Mar 1 Jun 1 $4.00 3 $90.00

Formula adds $75 and $50 instead of just showing the $50 YTD sales for the
previous period.

How can I tell it to look at the period prior to the current period if there
are 2 consecutive date ranges together without adding the 2 previous, but
the one that has the date period prior to the current period?

Thanks!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top