SUMPRODUCT formula help

brooksc29

Active Member
Joined
Jul 25, 2010
Messages
333
I'm not sure how to post this work easily through the thread, but here's a link to my work
http://s1015.photobucket.com/albums/...urrent=A-1.jpg

if you can view it it will be much easier to help me.

To start, I have named ranges on the worksheet:

A2:A31208 = DateRange
B2:B31208 = Pitcher
C2:C31208 = Batter
D2:D31208 = Inning
E2:E31208 = Catch
G2:U31210 = AllP

in colums A:E data is entered into rows 2, 5, & 8, etc all the way down to 31208, in every 3 cells, as every three cells are merged together. I have it set up that way b/c in G2:G31210 each row corresponds to either a Pitch (row 1, 4, 7, etc) a starting point (row 2, 5, 8, etc) and a finishing point (row 3, 6, 9, etc). I am trying to write formulas based upon the Date Range, name of Pitcher, Batter, Inning, or Catcher and where the Pitch Type (row 1, 4, 7) finished (row 3, 6, 9) for each place it started (row 2, 5, 8).

I have some drop down lists that lets the user choose the name of the pitcher, catcher, inning, or batter, and choose a date range. those cells will be referenced in the formulas that will determine the results the user is looking for.

In cell W2, I have the pitcher name the user chooses from a drop down list
In cell W3, I have the catcher name (options are All or choice of two catchers)
In cell W4, I have the Pitch Type (F, C, S, H, or All)
In cell W5, I have the Inning (options are 1,2,3,4,5,6,7,8,9, 1-3, 4-6, 7-9, or ALL)

There are 9 quadrants where I will be filtering information for, simply given numerical values 1-9. Right now I will use an example of quadrant 1.

I am trying to write formulas for the following (all entered as arrays):
1) For the most common finishing point for Pitch Types to a location (quadrant 1) I have, as an array:
=IFERROR(MODE(IF($B2:$B31210=$W$2,IF($G$2:$U$31208=$W$4,IF($G$3:$U$31209=1,IF(ISNUMBER($G$4:$U$31210 ),$G$4:$U$31210))))),"-")

This formula is figuring out most common quadrant that the pitch type in cell W4 finished in, that started in quadrant 1, for the pitcher name in cell W2. I need to add to this formula the ability to filter for inning, catcher, and batter, and date range, and I'm not sure how to do that. I also need the ability for filtering for ALL pitchers, ALL innings, ALL catchers, as well.

2) For total Pitch Types to a location (quadrant 1) I have, as an array:
=IFERROR(SUM(IF($B2:$B31210=$W$2,IF($G$2:$U$31208=$W$4,IF($G$3:$U$31209=1,$G$3:$U$31209)))),"-")

This formula is simply truing to total the number of pitch types in cell W4 for the quadrant 1 by the pitcher name in cell W2. Same as above, I need to add the ability to SUM when the user chooses a certain Catcher, Inning, Batter, Date Range, as well as the ALL function of the formula.

3) For total number of pitch type that didn't finish in same quadrant where they started
=SUMPRODUCT(($G2:$U$31208=$W$4)*($G3:$U$31209=1)*($G3:$U$31209<>$G4:$U$31210))

This formula is totaling the number of pitch type in cell W4, that finished in a zone different than quadrant 1. I need to add the ability to filter for the same as above. I have tried using this: =SUMPRODUCT(Pitcher=$W$2)*(CATCH=$W$3)*(Inning=$W$5)*(AllP=$W$4) - but it's giving me back 0 as a result. I'm wondering if it has to do w/ the merging of cells for Pitcher/Catch/Inning?

I realize this is an extremely long post and any help would be much appreciated!

Thank you so much!

p.s. I have also posted this thread on another site (http://www.excelforum.com/excel-general/773668-sumproduct-formula-help.html) for help. I am just hoping to increase my chances of assistance. I do not mean to offend anyone here.

Thank you!
 
ok, I think that formula is working! Many thanks...

Step 2 is making this formula work in the same way (regarding ALL)
=IFERROR(SUM(IF(PitcherName=$W$2,IF(CatcherName=$W$3,IF(Inning=$W$5,IF(AllP=$W$4,IF($G$3:$U$31209=1,$G$3:$U$31209)))))),"-")

will SUMPRODUCT work in the same way?
 
Upvote 0

Excel Facts

How can you automate Excel?
Press Alt+F11 from Windows Excel to open the Visual Basic for Applications (VBA) editor.
ok, I think that formula is working! Many thanks...

Great. Thanks for providing feedback.

Step 2 is making this formula work in the same way (regarding ALL)
=IFERROR(SUM(IF(PitcherName=$W$2,IF(CatcherName=$W$3,IF(Inning=$W$5,IF(AllP=$W$4,IF($G$3:$U$31209=1,$G$3:$U$31209)))))),"-")

will SUMPRODUCT work in the same way?

Yes...
 
Upvote 0
sounds good... could you help me with the formula?

this is what I have now
=SUMPRODUCT((PitcherName=$W$2)*(CatcherName=$W$3)*(GameDate>=StartDate)*(GameDate<=EndDate)*(AllP=$W$4)*($G3:$U$31209=1)*($G3:$U$31209<>$G4:$U$31210))
 
Upvote 0
I tried this... getting #VALUE as a result

=SUMPRODUCT(IF(PitcherName="ALL",PitcherName,$W$2))*(IF(CatcherName="ALL",CatcherName,$W$3)*(GameDate>=StartDate)*(GameDate<=EndDate)*(AllP=$W$4)*($G3:$U$31209=1)*($G3:$U$31209<>$G4:$U$31210))
 
Upvote 0
to explain a bit more specifically... I only need to "ALL" in PitcherName, CatcherName, and Inning, not on GameDate, AllP, or the rest of the ranges in the formula...

=SUMPRODUCT(IF(PitcherName="ALL",PitcherName,$W$2))*(IF(CatcherName="ALL",CatcherName,$W$3)*(IF(Inning="ALL",Inning,$W$5)*(GameDate>=StartDate)*(GameDate<=EndDate)*(AllP=$W$4)*($G3:$U$31209=1)*($G3:$U$31209<>$G4:$U$31210)))

still getting #VALUE as a result
 
Upvote 0
to explain a bit more specifically... I only need to "ALL" in PitcherName, CatcherName, and Inning, not on GameDate, AllP, or the rest of the ranges in the formula...

=SUMPRODUCT(IF(PitcherName="ALL",PitcherName,$W$2))*(IF(CatcherName="ALL",CatcherName,$W$3)*(IF(Inning="ALL",Inning,$W$5)*(GameDate>=StartDate)*(GameDate<=EndDate)*(AllP=$W$4)*($G3:$U$31209=1)*($G3:$U$31209<>$G4:$U$31210)))

still getting #VALUE as a result

Does this...
Code:
=SUMPRODUCT(
    --(PitcherName=IF(PitcherName="ALL",PitcherName,$W$2)),
    --(CatcherName=IF(CatcherName="ALL",CatcherName,$W$3)),
    --(Inning=IF(Inning="ALL",Inning,$W$5)),
    --(GameDate>=StartDate),
    --(GameDate<=EndDate),
    --(AllP=$W$4),
    --($G3:$U$31209=1),
    $G4:$U$31210)

as intended?

Note. Fom an audit point of view, mixing named ranges with ordinary ranges can lead to difficulties.
 
Upvote 0
Does this...
Code:
=SUMPRODUCT(
    --(PitcherName=IF(PitcherName="ALL",PitcherName,$W$2)),
    --(CatcherName=IF(CatcherName="ALL",CatcherName,$W$3)),
    --(Inning=IF(Inning="ALL",Inning,$W$5)),
    --(GameDate>=StartDate),
    --(GameDate<=EndDate),
    --(AllP=$W$4),
    --($G3:$U$31209=1),
    $G4:$U$31210)

Note. Fom an audit point of view, mixing named ranges with ordinary ranges can lead to difficulties.

ok, and I'm probably going to have an auditing issue...so, I changed the ordinary ranges of G3:U31209 to PitchStart and G4:U31210 to Pitch Finish.

and this was my formula
=SUMPRODUCT((PitcherName=IF(PitcherName="ALL",PitcherName,$W$2))*(CatcherName=IF(CatcherName="ALL",CatcherName,$W$3))*(Inning=IF(Inning="ALL",Inning,$W$5))*(AllP=IF(AllP="All",AllP,$W$4))*(GameDate>=StartDate)*(GameDate<=EndDate)*(PitchStart<>PitchFinish))

my result was 0 - and I know this isn't a correct result. Not sure why, b/c the formula makes sense to me...
 
Upvote 0
if I use an actual PitcherName, CatcherName, or Inning, this formula works. It's when I change one of them to ALL, it gives me 0 as a result
 
Upvote 0

Forum statistics

Threads
1,223,711
Messages
6,174,025
Members
452,542
Latest member
Bricklin

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