YTD INDEX MATCH

reacon84

New Member
Joined
Sep 13, 2016
Messages
36
Office Version
  1. 2016
Platform
  1. Windows
Hi all,

I've searched the forum but can't quite see what I'm after.

I have a budget file as below, and I would like the outputs in green to sum the YTD numbers. If Mar-22 is selected in A1, then I'd like columns C to E to be summed for each category. And if I change the date in A1, it will change the YTD numbers. I think it will be some sort of INDEX MATCH combo but can't quite get it to work!

Thanks in advance.

1669114051834.png


Mar-22
Jan-22Feb-22Mar-22Apr-22May-22Jun-22Jul-22Aug-22Sep-22Oct-22Nov-22Dec-22
Revenue303030303030303030303030
COS101010101010101010101010
Costs151515151515151515151515
Revenue90
COS30
Costs45
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
No index or match needed, just enter this formula into B8 then fill down,

Excel Formula:
=SUMPRODUCT(($C$3:$N$5)*($C$2:$N$2<=$A$1)*($B$3:$B$5=$A8))
 
Upvote 0
No index or match needed, just enter this formula into B8 then fill down,

Excel Formula:
=SUMPRODUCT(($C$3:$N$5)*($C$2:$N$2<=$A$1)*($B$3:$B$5=$A8))
Thank you!

I've heard that sumproduct formulas can really slow down a file - is this true?

The example I used was just an extract of a really large file, so I'm just conscious that the speed of the file will be affected?
 
Upvote 0
Sumproduct is an array function, so yes it can slow it down with large amounts of data. That said, it depends on what you consider large. If you have 3 formulas looking at #100k rows then it's not going to be noticeable. A lot of formulas looking at a small amount of data can be slower than a few formulas looking at a lot of data.

Are there multiple rows that will meet a single criteria in the actual data?
 
Upvote 0
Sumproduct is an array function, so yes it can slow it down with large amounts of data. That said, it depends on what you consider large. If you have 3 formulas looking at #100k rows then it's not going to be noticeable. A lot of formulas looking at a small amount of data can be slower than a few formulas looking at a lot of data.

Are there multiple rows that will meet a single criteria in the actual data?
Thanks for the explanation, makes sense. There are only about 200 rows (ie 200 formulas), so probably won't a difference based on what you say?

"Are there multiple rows that will meet a single criteria in the actual data?" As in my example, like 3 x "Revenue" in col B? No, they are all unique values (names of suppliers).
 
Upvote 0
200 formulas isn't bad, but it also depends how many rows of source data you have (C3:N5 in the example).

A different method that may be a bit faster depending on a few other things (order and number of rows in the source).
Excel Formula:
=SUMIFS(INDEX($C$3:$N$5,MATCH($A8,$B$3:$B$5,LOOKUP($A8,$B$3:$B$5)=$A8),0),$C$2:$N$2,"<="&$A$1)
The formula looks more complicated because it uses 2 match methods in 1 in an attempt to speed things up. If the first one finds a correct match then it will be very fast, if it doesn't then the second one will be slower but should still be a bit faster than sumproduct.
 
Upvote 0
Solution

Forum statistics

Threads
1,215,069
Messages
6,122,951
Members
449,095
Latest member
nmaske

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