Calculate monthly average and mid month average?

lichldo

Board Regular
Joined
Apr 19, 2022
Messages
65
Office Version
  1. 365
Platform
  1. MacOS
Hello, I have a set of daily numbers (excluding weekends) for every day of every month. At the end of the month, I need to calculate the percentage change from the first day of the month to the last day, and also the mid-month percentage change (from the middle day of the month to the last day of the month)

I'm wondering if there is a formula I can easily apply to all of my rows based on how my data is set up so that I don't have to adjust each months formula based on when the first day of the month is and to adjust for when the last day is (as some months have 30 days vs 31 days etc)

I've attached a sample sheet so you can see how it's set up - it's done this way so that we can do an easy copy paste from the system this data comes from, I understand it's not the most ideal way to format it, but it's the easiest way for us

The formulas are in Columns AG and AH


Sample Sheet - Averages.xlsx
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH
1PM1-Jan2-Jan3-Jan4-Jan5-Jan6-Jan7-Jan8-Jan9-Jan10-Jan11-Jan12-Jan13-Jan14-Jan15-Jan16-Jan17-Jan18-Jan19-Jan20-Jan21-Jan22-Jan23-Jan24-Jan25-Jan26-Jan27-Jan28-Jan29-Jan30-Jan31-JanMid Month Difference Month Difference
2A47,829.4147,829.4147,829.4147,829.4147,829.4147,829.4147,829.4139,755.0039,755.0039,755.00397553975539,755.0039,755.0046,935.0046,935.0046,935.0046,935.0046,935.0066,220.7164,320.7161.79%N/A
3B93,027.4593,027.4571,062.4171,062.4169,517.9758,011.8658,011.8658,011.8658,011.8658,011.8658011.8658011.8658,011.8658,011.8658,011.8658,280.6157,245.6657,245.6656,178.5455,756.5855,756.58-3.89%N/A
4CN/AN/A
5DN/AN/A
6EN/AN/A
7FN/AN/A
8GN/AN/A
9HN/AN/A
10IN/AN/A
11JN/AN/A
12KN/AN/A
13LN/AN/A
14MN/AN/A
15NN/AN/A
16ON/AN/A
17PN/AN/A
18QN/AN/A
19RN/AN/A
20SN/AN/A
21TN/AN/A
22UN/AN/A
23VN/AN/A
24WN/AN/A
25XN/AN/A
26YN/AN/A
27ZN/AN/A
28AAN/AN/A
29ABN/AN/A
30
31PM1-Feb2-Feb3-Feb4-Feb5-Feb6-Feb7-Feb8-Feb9-Feb10-Feb11-Feb12-Feb13-Feb14-Feb15-Feb16-Feb17-Feb18-Feb19-Feb20-Feb21-Feb22-Feb23-Feb24-Feb25-Feb26-Feb27-Feb28-Feb   Mid Month Difference Month Difference
32A104,502.3517,175.0017,175.0017,175.0017,175.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.009,075.009,075.00-22.93%-91.32%
33B125,987.79125,987.79125,987.79125,987.79125,987.7974,109.3574,603.3874,603.3874,603.3874,603.3868,565.5668,565.5666,359.5566,529.5563,811.6363,811.6363,811.6363,534.9663,412.6563,412.65-15.00%-49.67%
34CN/AN/A
35DN/AN/A
36EN/AN/A
37FN/AN/A
38GN/AN/A
39HN/AN/A
40IN/AN/A
41JN/AN/A
42KN/AN/A
43LN/AN/A
44MN/AN/A
45NN/AN/A
46ON/AN/A
47PN/AN/A
48QN/AN/A
49RN/AN/A
50SN/AN/A
51TN/AN/A
52UN/AN/A
53VN/AN/A
54WN/AN/A
55XN/AN/A
56YN/AN/A
57ZN/AN/A
58AAN/AN/A
59ABN/AN/A
Sheet1
Cell Formulas
RangeFormula
C1:AF1,C31:AF31C1=IF(B1="","",IF(MONTH(B1+1)<>MONTH(B1),"",B1+1))
AG2:AG29AG2=IFERROR((AF2-O2)/O2,"N/A")
AH2:AH29AH2=IFERROR((AF2-B2)/B2,"N/A")
AG32:AG59AG32=IFERROR((AC32-O32)/O32,"N/A")
AH32:AH59AH32=IFERROR((AC32-B32)/B32,"N/A")
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Hi, try this for "Month Difference" column. How do you define the "Mid Month day" in relation to the total month days, and what if it's a weekend?
Book1
ABCDEFGHIJKLMNOPQRSTUVWXYZAAABACADAEAFAGAH
1PM2022/1/12022/1/22022/1/32022/1/42022/1/52022/1/62022/1/72022/1/82022/1/92022/1/102022/1/112022/1/122022/1/132022/1/142022/1/152022/1/162022/1/172022/1/182022/1/192022/1/202022/1/212022/1/222022/1/232022/1/242022/1/252022/1/262022/1/272022/1/282022/1/292022/1/302022/1/31Mid Month Difference Month Difference
2A47,829.4147,829.4147,829.4147,829.4147,829.4147,829.4147,829.4139,755.0039,755.0039,755.0039,755.0039,755.0039,755.0039,755.0046,935.0046,935.0046,935.0046,935.0046,935.0066,220.7164,320.7134.48%
3B93,027.4593,027.4571,062.4171,062.4169,517.9758,011.8658,011.8658,011.8658,011.8658,011.8658,011.8658,011.8658,011.8658,011.8658,011.8658,280.6157,245.6657,245.6656,178.5455,756.5855,756.58-40.06%
4C
30
31PM2022/2/12022/2/22022/2/32022/2/42022/2/52022/2/62022/2/72022/2/82022/2/92022/2/102022/2/112022/2/122022/2/132022/2/142022/2/152022/2/162022/2/172022/2/182022/2/192022/2/202022/2/212022/2/222022/2/232022/2/242022/2/252022/2/262022/2/272022/2/28   Mid Month Difference Month Difference
32A104,502.3517,175.0017,175.0017,175.0017,175.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.0011,775.009,075.009,075.00-91.32%
33B125,987.79125,987.79125,987.79125,987.79125,987.7974,109.3574,603.3874,603.3874,603.3874,603.3868,565.5668,565.5666,359.5566,529.5563,811.6363,811.6363,811.6363,534.9663,412.6563,412.65-49.67%
34C
Sheet1
Cell Formulas
RangeFormula
C31:AF31,C1:AF1C1=IF(B1="","",IF(MONTH(B1+1)<>MONTH(B1),"",B1+1))
AH2,AH32:AH33AH2=LOOKUP(9^9,B2:AF2)/INDEX(B2:AF2,MATCH(TRUE,INDEX(ISNUMBER(B2:AF2),0),0))-1
AH3AH3=LOOKUP(9^9,A3:AE3)/INDEX(A3:AE3,MATCH(TRUE,INDEX(ISNUMBER(A3:AE3),0),0))-1
 
Upvote 0

Forum statistics

Threads
1,224,740
Messages
6,180,678
Members
452,993
Latest member
FDARYABEE

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