SumProduct with dynamic column range not calculating properly

DravenExcel

New Member
Joined
Feb 18, 2020
Messages
6
Office Version
  1. 2016
Platform
  1. Windows
Hi everyone,

First time posting so bare with me.

I'm trying use sumproduct to total up the numbers in a data table within a dynamic column range based on a cell value that corresponds to the header titles.

These titles are default titles from a report that for simplicity can't be changed. The table name is Tab_Test. and cell J6 is a drop down menu to toggle between the different Periods in the report.

My current formula is =SUMPRODUCT((Tab_Test[[P1]:[P12]])*(Tab_Test[Department]=I9)*(Tab_Test[[#Headers],[P1]:[P12]]>="P1")*(Tab_Test[[#Headers],[P1]:[P12]]<=$J$6))


Capture.JPG


The problem is that the initial "P1" in the formula is picking up the P1 from P10, P11, P12 and adding them to the totals.

Is there a way to adjust the formula so that it still picks up the range but only looks for the exact number/value?

Any help would be appreciated!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Try changing:
the headers to P01, P02, ....,P09,P10,P11,P12
J6 to P09

and try this formula
=SUMPRODUCT((Tab_Test3[[P01]:[P12]])*(Tab_Test3[Department]=I9)*(Tab_Test3[[#Headers],[P01]:[P12]]>="P01")*(Tab_Test3[[#Headers],[P01]:[P12]]<=$J$6))

M.
 
Upvote 0
Their default titles off of a pre-set report.

I'm developing this template for people who aren't very knowledgeable in Excel. I'm trying to set it us so they have to just insert the report and the information they need is then generated for them. =/
 
Upvote 0
Their default titles off of a pre-set report.

I'm developing this template for people who aren't very knowledgeable in Excel. I'm trying to set it us so they have to just insert the report and the information they need is then generated for them. =/

Maybe something like this

Pasta1
ABCDEFGHIJKLM
1DepartmentP1P2P3P4P5P6P7P8P9P10P11P12
2Marketing111111111111
3R&D111111111111
4Marketing111111111111
5
6StartP1
7Up to periodP9
8
9Total
10Marketing18
11R&D9
Plan1
Cell Formulas
RangeFormula
J10:J11J10=SUMPRODUCT((Tab_Test[[P1]:[P12]])*(Tab_Test[Department]=I10)*(COLUMN(Tab_Test[[#Headers],[P1]:[P12]])-COLUMN(Tab_Test[[#Headers],[P1]])+1>=MATCH(J$6,Tab_Test[[#Headers],[P1]:[P12]]))*(COLUMN(Tab_Test[[#Headers],[P1]:[P12]])-COLUMN(Tab_Test[[#Headers],[P1]])+1<=MATCH(J$7,Tab_Test[[#Headers],[P1]:[P12]],0)))


M.
 
Upvote 0

Forum statistics

Threads
1,214,950
Messages
6,122,436
Members
449,083
Latest member
Ava19

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