Formula or VBA for excel to auto target 7 days of data of past week

determinedtoexceed

New Member
Joined
Aug 20, 2019
Messages
38
Dear Sirs

Is there a way for excel functions or VBA to automatically target "the 7 dates of last week" and calculate the 7 days average , and taking this data to shown on for example cell AAA9?

Book1
ABCDEFGHIJKLMNOPQRSTUVWX
1
2MonTueWedThuFriSatSunMonTueWedThuFriSatSunMonTueWedThuFriSat
3Item 2019/11/182019/11/192019/11/202019/11/212019/11/222019/11/232019/11/242019/11/252019/11/262019/11/272019/11/282019/11/292019/11/30Nov. FCSTNov. Actual vs FCSTNov. sales order issued2019/12/12019/12/22019/12/32019/12/42019/12/52019/12/62019/12/7
40006TW-816-641-524-714-611-680-962-816-642-666-855-92316360102.74%-16808-8-1062-1370
50036TW-486-452-325-362-358-56-1-549-502-424-465-450-6098601129.39%-11129-723-1080
60049TW-188-141-125-132-147-170-175-199-161-134-170-2063152114.28%-3602-194-330
Sheet1

[/QUOTE]
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi there,
I'd go for a =AVERAGEIFS formula, where you have two conditions, something in this direction:
AAA9: =AVERAGEIFS (A9:ZZ9,A$3:ZZ$3,">="&DATE(2019,12,12),A$3:ZZ$3,"<="&DATE(2019,12,19))
Cheers,
Koen
 
Upvote 0
Hi there,
I'd go for a =AVERAGEIFS formula, where you have two conditions, something in this direction:
AAA9: =AVERAGEIFS (A9:ZZ9,A$3:ZZ$3,">="&DATE(2019,12,12),A$3:ZZ$3,"<="&DATE(2019,12,19))
Cheers,
Koen
Hi Rijin,

thank you, but is there a way without manually input =DATE(*,*), which the system can automatically recognize "when was past week"

sorry for the late reply.
 
Upvote 0
Try TODAY() and TODAY()-7... Or you'd have to come up with with a fancier "past week" definition, could e.g. be =TODAY()-WEEKDAY(TODAY(),2) -> this will always give you last sunday.
Cheers,
Koen
 
Upvote 0

Forum statistics

Threads
1,213,489
Messages
6,113,953
Members
448,535
Latest member
alrossman

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