Sum with INDEX()

Zaigham

Board Regular
Joined
Dec 22, 2010
Messages
159
Office Version
  1. 2021
Platform
  1. Windows
  2. Mobile
Being a novice I am unable to understand the logic of below mentioned example (found at ExcelisFun)that how the formula calculates the value of sales with the help of INDEX(), I have tried to break the formula in parts but the result of =INDEX(B5:B18,MATCH(D5,A5:A18,0)) comes to "2" which is the 2nd value or reference of the SUM(). But when I enter =SUM(B5:2) it gives error message and do not allow to enter the function.


Excel Workbook
ABCDEFGH
4DaySales*Select final day for summing purposesSum Through Day10***
5Day1$1.00*Day10$17.00***
6Day2$2.00**$17.00***
7Day3$1.00******
8Day4$2.00******
9Day5$2.00******
10Day6$2.00******
11Day7$2.00*10MATCH(D5,A5:A18,0)***
12Day8$1.00*2INDEX(B5:B18,MATCH(D5,A5:A18,0))***
13Day9$2.00*17.00SUM(B5:INDEX(B5:B18,MATCH(D5,A5:A18,0)))***
14Day10$2.00******
15Day11$1.00**SUM(B5:2) gives Error message***
16Day12$2.00******
17Day13$1.00******
18Day14$1.00******
19********
I(12)


I hope that somebody will spare his valuable time for me.
 

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
Being a novice I am unable to understand the logic of below mentioned example (found at ExcelisFun)that how the formula calculates the value of sales with the help of INDEX(), I have tried to break the formula in parts but the result of =INDEX(B5:B18,MATCH(D5,A5:A18,0)) comes to "2" which is the 2nd value or reference of the SUM(). But when I enter =SUM(B5:2) it gives error message and do not allow to enter the function.


Excel Workbook
ABCDEFGH
4DaySales*Select final day for summing purposesSum Through Day10***
5Day1$1.00*Day10$17.00***
6Day2$2.00**$17.00***
7Day3$1.00******
8Day4$2.00******
9Day5$2.00******
10Day6$2.00******
11Day7$2.00*10MATCH(D5,A5:A18,0)***
12Day8$1.00*2INDEX(B5:B18,MATCH(D5,A5:A18,0))***
13Day9$2.00*17.00SUM(B5:INDEX(B5:B18,MATCH(D5,A5:A18,0)))***
14Day10$2.00******
15Day11$1.00**SUM(B5:2) gives Error message***
16Day12$2.00******
17Day13$1.00******
18Day14$1.00******
19********
I(12)


I hope that somebody will spare his valuable time for me.
In this application the INDEX(...) function returns a REFERENCE.

=SUM(B5:INDEX(B5:B18,MATCH(D5,A5:A18,0)))

MATCH = 10

INDEX(B5:B18,10) = B14

So:

=SUM(B5:B14)
 
Upvote 0
Hello Biff

Thank you very much for explanation. Actually I am unable to differentiate between "array form" and "reference form" of INDEX() so it is difficult for me to recognize the form of INDEX(). May be more practice, help me to overcome this problem.

Zaigham
 
Upvote 0
Hello Biff

Thank you very much for explanation. Actually I am unable to differentiate between "array form" and "reference form" of INDEX() so it is difficult for me to recognize the form of INDEX(). May be more practice, help me to overcome this problem.

Zaigham
Practice makes perfect!

Some day it will just "click" and then you realize that most of this stuff is fairly easy and makes perfect sense.

Thanks for the feedback! :cool:
 
Upvote 0
Thanks for guidance and encouragement. So nice of you.:laugh:
 
Upvote 0

Forum statistics

Threads
1,224,579
Messages
6,179,656
Members
452,934
Latest member
mm1t1

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