Countif and offset problem over several columns

jacko2401

New Member
Joined
Aug 24, 2011
Messages
35
Hi

I am trying to record the number of times a someone gets a yellow or red card from a results worksheet for my local club. The results worksheet has column headings of the following:

Columns A-G (Match details), Column H (Player 1 name), Column I (Number of Goals scored), Column J (Yellow or Red), Column K (Player 2 name), Column I (Number of Goals scored), Column J (Yellow or Red) and so on for all 14 players.

In a seperate worksheet I am recording the stats with the following column headings:
Column A (Player Name), Column B (Appearances), Column C (Sub Appearances), Column D (Goals), Column E (Yellows), Column F (Reds)

I have got formulas for playter name, appearances, sub appearances and goals but unable to record the yellow or reds.

I am trying to construct a formula that searches for the player name throughout the results worksheet, takes an offset of 2 columns to the right (as that is the cell that will either be blank, Yellow or Red. It then needs to counts whether that cell's value is Yellow and count the occurences for that player. I then need to repeat this for Red.

I'm stumped as this formula has to do a 2 layer count ifs and is counting occurences of text being in a cell rather than counting numbers.

Does anyone have any idea how I can tackle this?

Thanks
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
You can use a SUMPRODUCT with the second range offset by two columns. This example is a little more simplistic than yours but the concept is identical. If you don't understand it or need help implementing, just respond back.

Excel 2007
ABCDEFGHIJKLMNOPQRSTU
1Match Detailsp1 namep1 goalsp1 cardsp2 namep2 goalsp2 cardsp3 namep3 goalsp3 cardsYellowRed
2joe1sam0bob0Yellowsam00
3sam0joe0bob0bob11
4bob0Redjoe0Redsam2joe01
Sheet1
Cell Formulas
RangeFormula
T2=SUMPRODUCT(--($H$2:$N$4=$S2),--($J$2:$P$4=T$1))
T3=SUMPRODUCT(--($H$2:$N$4=$S3),--($J$2:$P$4=T$1))
T4=SUMPRODUCT(--($H$2:$N$4=$S4),--($J$2:$P$4=T$1))
U2=SUMPRODUCT(--($H$2:$N$4=$S2),--($J$2:$P$4=U$1))
U3=SUMPRODUCT(--($H$2:$N$4=$S3),--($J$2:$P$4=U$1))
U4=SUMPRODUCT(--($H$2:$N$4=$S4),--($J$2:$P$4=U$1))
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

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