Formula for counting with two criteria, name and counting for baseball stats

elketa1252

New Member
Joined
May 19, 2017
Messages
16
Guys,

I have a baseball team and would like a formula to keep the stats. For example, I would like a formula in Cell F3 that counts how many 1b(from Cell F2) does Salvador Martinez(Cell B3) has in the range B33:F:40. So this formula would need to match B3 and find the rows where Salvador Martinez is and add all the 1b. The return would be 3, the ones in yellow. I would use the formula for the other players and for the different stats found in ranges F:2N2. Just to throw another example, these are in red for Jose Perez HR, Cell I7, this formula would return 2 here. Any help would be much appreciated. I have tried all types of formula, index match sumproduct and just cannot do it. Sorry for my english, it's my second language.

Thank you. And I tried upload a picture but it's asking me for an URL instead of uploading from my computer.


B C D E F G H I J K L M N O P Q R S
[TABLE="width: 783"]
<tbody>[TR]
[TD]2 Name[/TD]
[TD]PA[/TD]
[TD]AB[/TD]
[TD]H[/TD]
[TD]1b[/TD]
[TD]2b[/TD]
[TD]3b[/TD]
[TD]HR[/TD]
[TD]ROE[/TD]
[TD]SACf[/TD]
[TD]BB[/TD]
[TD]GDP[/TD]
[TD]Ks[/TD]
[TD]RBI[/TD]
[TD]RUNS[/TD]
[TD]BA[/TD]
[TD]OB%[/TD]
[TD]Slug%[/TD]
[/TR]
[TR]
[TD]3 Salvador Martinez[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]#N/A[/TD]
[TD]#N/A[/TD]
[TD]#N/A[/TD]
[/TR]
[TR]
[TD]4 Miguel Rosario[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0[/TD]
[TD]0.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][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
[TR]
[TD][TABLE="width: 314"]
<tbody>[TR]
[TD]33 Salvador Martinez[/TD]
[TD]2b[/TD]
[TD]1b[/TD]
[TD]2b[/TD]
[TD]hr[/TD]
[/TR]
[TR]
[TD]34 Yoel Martinez[/TD]
[TD]2b[/TD]
[TD]hr[/TD]
[TD]2b[/TD]
[TD]1b[/TD]
[/TR]
[TR]
[TD]35 Jose Perez[/TD]
[TD]2b[/TD]
[TD]1b[/TD]
[TD]hr[/TD]
[TD]hr[/TD]
[/TR]
[TR]
[TD]36 Miguel Rosario[/TD]
[TD]hr[/TD]
[TD]2b[/TD]
[TD]3b[/TD]
[TD]3b[/TD]
[/TR]
[TR]
[TD]37 Frank Guzman[/TD]
[TD]1b[/TD]
[TD]2b[/TD]
[TD]3b[/TD]
[TD]2b[/TD]
[/TR]
[TR]
[TD]38 Salvador Martinez[/TD]
[TD]3b[/TD]
[TD]2b[/TD]
[TD]3b[/TD]
[TD]3b[/TD]
[/TR]
[TR]
[TD]39 Galindo Gomez[/TD]
[TD]2b[/TD]
[TD]3b[/TD]
[TD]3b[/TD]
[TD]2b[/TD]
[/TR]
[TR]
[TD]40 Salvador Martinez[/TD]
[TD]2b[/TD]
[TD]1b[/TD]
[TD]1b[/TD]
[TD]hr[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]
 

Excel Facts

Copy a format multiple times
Select a formatted range. Double-click the Format Painter (left side of Home tab). You can paste formatting multiple times. Esc to stop
This?


Excel 2010
ABCDEFGHIJKLMNOPQR
1NamePAABH1b2b3bHRROESACfBBGDPKsRBIRUNSBAOB%Slug%
2Salvador Martinez00034320000000000
3Miguel Rosario00001210000000000
4Frank Guzman00012100000000000
5Galindo Gomez00002200000000000
6Jose Perez00011020000000000
7
8
9Salvador Martinez2b1b2bhr
10Yoel Martinez2bhr2b1b
11Jose Perez2b1bhrhr
12Miguel Rosariohr2b3b3b
13Frank Guzman1b2b3b2b
14Salvador Martinez3b2b3b3b
15Galindo Gomez2b3b3b2b
16Salvador Martinez2b1b1bhr
Sheet2
Cell Formulas
RangeFormula
B2=SUMPRODUCT(($A$9:$A$16=$A2)*($B$9:$E$16=B$1))
 
Upvote 0
Hey wow thank you very much but I can't get it to work. I am pretty sure that might be the solution because most of the solutions online i searched brought me to something like this but it doesn't work for me. Im using excel 2016. could that be it? This is the formula I pasted specifically in Cell F3 and it just doesn't work . =SUMPRODUCT(($B$33:$B$40=$B3)*($C$33:$F$40=F$2))

Do you have the file because all the results you got is exactly what I need.

Thank you again for all your help.
 
Upvote 0
Sorry I just realized your table is setup different than mine, the columns and rows, but the formula I pasted in my reply is in the right location in my file. Don't want to confuse you.
 
Upvote 0
your table is setup different than mine

This any better?


Excel 2010
BCDEFGHIJKLMNOPQRS
2NamePAABH1b2b3bHRROESACfBBGDPKsRBIRUNSBAOB%Slug%
3Salvador Martinez00034320000000000
4Miguel Rosario00001210000000000
5Frank Guzman00012100000000000
6Galindo Gomez00002200000000000
7Jose Perez00011020000000000
31
32
33Salvador Martinez2b1b2bhr
34Yoel Martinez2bhr2b1b
35Jose Perez2b1bhrhr
36Miguel Rosariohr2b3b3b
37Frank Guzman1b2b3b2b
38Salvador Martinez3b2b3b3b
39Galindo Gomez2b3b3b2b
40Salvador Martinez2b1b1bhr
Sheet2
Cell Formulas
RangeFormula
C3=SUMPRODUCT(($B$33:$B$40=$B3)*($C$33:$F$40=C$2))
 
Upvote 0
Sorry maybe I did not explain myself well. I have the formula and understand it, it's just that excel doesn't do the calculation, it just returns 0, it does not do the calculation for me. I tried it as an array formula too with ctrl shift and enter and nothing, it just returns 0. I even changed the locations of all the cells to match yours and copied and pasted the formula and nothing. It's a file done in a 1997-2003 excel format but Im using 2016 excel. Could that be it since Im pretty sure I have everything the right way.
 
Upvote 0
Have you checked to see if Calculation is set to manual or automatic?
 
Upvote 0
Be sure that you are dragging the formula in B2 across and down (using the 1st example provided).
 
Last edited:
Upvote 0
Have you checked to see if Calculation is set to manual or automatic?

Thanks for the reply. I just checked in the options > formulas and it's set to automatic. I'm sorry for the back and forth. It's supposed to be automatic I imagine right?
 
Upvote 0
Be sure that you are dragging the formula in B2 across and down (using the 1st example provided).

It's not when I'm dragging, it's just that the first formula doesn't even work. I have a little knowledge of excel and I know that $ is to lock the cell if that's what you mean. Once I get a cell to work I will know how to make it work every where but it doesn't even work on the first cell. Thanks for your help.
 
Upvote 0

Forum statistics

Threads
1,224,813
Messages
6,181,118
Members
453,021
Latest member
Justyna P

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