• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Average formula if different cell & column

stormania

Member
Dear Excel Master

Kindly help , how to make formula average ? (formula average : 2 month actual sales before current month and 3 month forecast) (yellow cell)

Thank you
 

Attachments

  • Average different cell column.xlsx
    14.4 KB · Views: 5
If you can add a helper column (or use a let statement?)
[H5] = DATE(2000+B5:B72;XMATCH(A5:A72;{"Jan";"Feb";"Mar";"Apr";"May";"Jun";"Jul";"Aug";"Sep";"Oct";"Nov";"Dec"});1)
[F5] =
=(SUM(($F$5:$F$72)*($D$5:$D$72=D5)*($H$5#>=EDATE(H5;-2))*($H$5#<EDATE(H5;0)))+
SUM(($G$5:$G$72)*($D$5:$D$72=D5)*($H$5#>=EDATE(H5;0))*($H$5#<EDATE(H5;3)))
)/(SUM(($D$5:$D$72=D5)*($H$5#>=EDATE(H5;-2))*($H$5#<EDATE(H5;0)))
+SUM(($D$5:$D$72=D5)*($H$5#>=EDATE(H5;0))*($H$5#<EDATE(H5;3))))

Aweful, but it seems to do the job.
There is some redundancy, so that can be avoided by playing with the "+" and putting it in the correct order, since that's an or statement. But I don't have a fresh mind due to a lack of sleep to figure it out.
 

Attachments

  • Average different cell column.xlsx
    19.4 KB · Views: 2
Back
Top