How do I adjust this formula to use an unknown cell?

Peter h

Active Member
Joined
Dec 8, 2015
Messages
417
I have this formula that returns the average of data in Column D, if the date in Column A is within 2 dates. It works fine if I specify what Cell has the initial date to compare to, but as data is added, I won't always know which cell in Column A that will be. Here's the formula I have.

=ROUND(AVERAGEIFS(D:D,$A:$A,">="&$A$3,$A:$A,"<="&$A$3+(DAY(EOMONTH($A$3,0)-1))),2)

So, starting in A3 I have dates that start with "1/1/2018". So this formula gives me the average of all data that was entered in the month of January. Lets say I want to see the Average of all data that was entered in the month of February, but I don't know what cell is contains "2/1/2018". How would I change the "A3" reference to find where the next month begins? Thanks.
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)
Hello Peter :biggrin:
This is probably a very lengthy way of figuring out the starting date :biggrin:
dates are from a1 to a17
23-Sep01-Oct
24-Sep0
25-Sep0
26-Sep0
27-Sep0
28-Sep0
29-Sep0
30-Sep0
01-Oct1
02-Oct0
03-Oct0
04-Oct0
05-Oct0
06-Oct0
07-Oct0
08-Oct0
09-Oct0

<colgroup><col><col><col></colgroup><tbody>
</tbody>

in b2 i used this formula n dragged till b17
Code:
=IF(AND(ISBLANK(A1)=FALSE,(MONTH(A1)<>MONTH(A2))),1,0)
in c1 i used this formula
Code:
=INDEX(A:A,MATCH(1,B1:B17,0))
now value of c1 can be used as the starting date :biggrin:
 
Upvote 0

Forum statistics

Threads
1,214,979
Messages
6,122,550
Members
449,088
Latest member
davidcom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top