Automatically add new Month and pick values automatically based on Month no and subtract from previous month

hananak

Board Regular
Joined
Feb 10, 2022
Messages
69
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi All,

I am struggling to write a formula which will check the current month and then subtract from the current month the previous month.

Your help would be appreciated.



Formula Required.xlsx
DEFGHIJKLMNOPQRST
1
2M5
3
4ExpenditureM1M2M3M4M5M6M7M8M9M10M11M12Current MonthMoM MovementMovement %
5Expense 15060702510-------10(15)-150%
6Expense 2203035159-------9(6)-67%
7Expense 39018020104-------4(6)-150%
8
9
10
11Currently the formula in column R picks values based on month chosen in cell E2
12
13I want a formula in column T to check the what is the current month and subtract from it previous month.
14
15For example if current month is M5 then subtract from M5 the M4 values, if current month is M6 then subtract M5 values from it and if current month is M1 then it should have value 0 as there is no movement.
Sheet2
Cell Formulas
RangeFormula
R5:R7R5=INDEX($E5:$P5,,MATCH($E$2,$E$4:$P$4,0))
S5:S7S5=+R5-H5
T5:T7T5=+IFERROR(S5/R5,"")
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.
Check the green highlighted cells. Most of the things you had already done correctly. All you needed was a concept to improvise.

I'm giving you the same. Check this -

Book1
DEFGHIJKLMNOPQRST
2M5StartMay-2023
3
4ExpenditureMay-2023Jun-2023Jul-2023Aug-2023Sep-2023Oct-2023Nov-2023Dec-2023Jan-2024Feb-2024Mar-2024Apr-2024Current MonthMoM MovementMovement %
5Expense 15060702510000000010-15-150%
6Expense 220303515900000009-15-67%
7Expense 3901802010400000004-15-150%
Sheet1
Cell Formulas
RangeFormula
E4E4=EOMONTH($G$2,0)
F4F4=EOMONTH($G$2,1)
G4G4=EOMONTH($G$2,2)
H4H4=EOMONTH($G$2,3)
I4I4=EOMONTH($G$2,4)
J4J4=EOMONTH($G$2,5)
K4K4=EOMONTH($G$2,6)
L4L4=EOMONTH($G$2,7)
M4M4=EOMONTH($G$2,8)
N4N4=EOMONTH($G$2,9)
O4O4=EOMONTH($G$2,10)
P4P4=EOMONTH($G$2,11)
R5:R7R5=INDEX($E5:$P5,,MATCH(EOMONTH(TODAY(),0),$E$4:$P$4,0))
S5:S7S5=INDEX($E5:$P5,,MATCH(EOMONTH(TODAY(),0),$E$4:$P$4,0))-INDEX($E5:$P5,,MATCH(EOMONTH(TODAY(),-1),$E$4:$P$4,0))
T5T5=IFERROR(S5/R5,"")
T6:T7T6=+IFERROR(S6/R6,"")
 
Upvote 0

Forum statistics

Threads
1,215,079
Messages
6,122,998
Members
449,092
Latest member
masterms

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