Vlookup+sumifs in a Moving Trend Analysis

nymyth

Board Regular
Joined
Mar 4, 2010
Messages
104
Hi all, as usual I need some experts help on an excel formula issue I have. I tried to use different formulas to get it working, but nothing I do is really working.

In the attached file I have 2 sheets:
Sheet1 - Data Dump
Sheet 2 - Analysis

In Sheet 1 only the data will change, the rows and columns will be identical (other than the years on Row 1) - so Periods # - 12 for Last Year and # - 12 for Current Year will always be where they are.

In Sheet 2 Cell P2 will have the Current Month and Year depending on a variable on a data sheet (not included here). So if the data sheet has the month as May 2016, cell P2 will read May 2016, if the data sheet has the month as April 2016, cell P2 will read April 2016 - and the previous cells will automatically adjust subtracting one month from the prior month until I have a full cycle. So if the variable is May 2016 my cells will read May 2015 to May 2016.

Now what I require help with is the following, in Cell D5 I need it to find Current Assets in Sheet 1 and sum from C11:H11. In Cell E5 from C11:I11 and so on. Then we arrive at Sheet 2 Cell L5 i need it sum from P11:Q11 and so on.

It get complex here because those dates will change every month and I need the formula to also adapt as the months go by. Is this possible? If so, can someone help? Thanks again.

Sheet 1

ABCDEFGHIJKLMNOPQRSTUVWXYZAAAB
Calendar Year20152015201520152015201520152015201520152015201520152016201620162016201620162016201620162016201620162016
Period#123456789101112#123456789101112
BALANCE SHEETBalance sheet
00000000000000000000000000
1000000000Assets5809309305807769868539236089799868539868536086086086086080000000
1100000000Non current assets2604604602603724924164562764884924164924162762762762762760000000
1110000000Property, plant and equipment100100100100100100100100100100100100100100100100100100100
1120000000Intangible assets40909040689879894497987998794444444444
1130000000Investments in Associates & Non consolidated joint ventures40909040689879894497987998794444444444
1140000000Other non current investments40909040689879894497987998794444444444
1150000000Deferred tax assets40909040689879894497987998794444444444
1200000000Current assets3204704703204044944374673324914944374944373323323323323320000000

<tbody>
</tbody>

Sheet 2
ABCDEFGHIJKLMNOP
May 2015Jun 2015Jul 2015Aug 2015Sep 2015Oct 2015Nov 2015Dec 2015Jan 2016Feb 2016Mar 2016Apr 2016May 2016
2015201520152015201520152015201520162016201620162016
5678910111212345
1200000000Current assets
1210000000Inventories
1000000000Assets
2220000000Current liabilities
2200000000Liabilities
2100000000Equity

<tbody>
</tbody>

TinyUpload.com - best file hosting solution, with no limits, totaly free
 
Last edited:

Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.
Hi Sd, thank you for your response, unfortunately I cannot rearrange the data as that is how it comes out of our system. However, I did workout a solution, it probably isn't the prettiest but it did the trick:

Here is the formula
Code:
=(SUMIFS(INDEX(BSLvL4,MATCH(TEXT($B9,0),BSAccountsLvL4,0),0),CalYear,F$5,BSPeriodsLvL4,"<="&F$6)+SUMIFS(INDEX(BSLvL4,MATCH(TEXT($B9,0),BSAccountsLvL4,0),0),CalYear,F$5,BSPeriodsLvL4,"="&"#"))

BSLvL4 = range of all my data
BSAccountsLvL4 = range of my accounts
CalYear = range of my years
BSPeriodsLvL4 = range of my periods

Code:
=(SUMIFS(INDEX(BSLvL4,MATCH(TEXT($B9,0),BSAccountsLvL4,0),0),CalYear,F$5,BSPeriodsLvL4,"<="&F$6))
$B9 is pointing to my first account
F$5 is pointing to the year in that column
F$6 is pointing to the month in that column

Code:
=(SUMIFS(INDEX(BSLvL4,MATCH(TEXT($B9,0),BSAccountsLvL4,0),0),CalYear,F$5,BSPeriodsLvL4,"="&"#"))
Pretty much the same as above except the last part of the code changes to add the opening balance which is referenced by "#" in my data dump sheet
 
Last edited:
Upvote 0
Does this single formula set up work for you?
Rich (BB code):
=SUMPRODUCT(SUMIFS(INDEX(BSLvL4,MATCH(TEXT($B9,0),BSAccountsLvL4,0),0),
    CalYear,F$5,BSPeriodsLvL4,CHOOSE({1,2},"<="&F$6,"="&"#")))
 
Last edited:
Upvote 0
Totally forgot to thank you for that code, so "thanks" :)

Does this single formula set up work for you?
Rich (BB code):
=SUMPRODUCT(SUMIFS(INDEX(BSLvL4,MATCH(TEXT($B9,0),BSAccountsLvL4,0),0),
    CalYear,F$5,BSPeriodsLvL4,CHOOSE({1,2},"<="&F$6,"="&"#")))
 
Upvote 0
Holy hell, that worked perfectly. Any chance you can explain what you did there?

CHOOSE collects the evaluations of its arguments into an array-constant.

Let's say that F6 = 1-Mar-2016.

CHOOSE then yields:

{"<=1-Mar-2016","#"}

which is a two criterion set that must hold BSPeriodsLvL4.

SUMIFS proceeds and creates two totals corresponding to each criterion in this set...

=SUMPRODUCT({15,30})

>> 45

That is, SumProduct totals the two totals.

Hope this helps.

Totally forgot to thank you for that code, so "thanks" :)

You are welcome.
 
Upvote 0

Forum statistics

Threads
1,216,110
Messages
6,128,892
Members
449,477
Latest member
panjongshing

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