Countif with Index-Match

Jasesair

Active Member
Joined
Apr 8, 2015
Messages
282
Office Version
  1. 2016
I have some mocked up data below. I'm not sure how but I'm wanting to lookup James in column B and count how many values there are for James...but only count the first # columns based on A1. In the below case, A1 is 4 so the formula would count from cells C5:F5. Result for James would be 1. If looking up John, the result would be 3.

Can anyone assist please? Hopefully I've explained properly.

Excel Help.png
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Heres a couple:

=COUNT(INDEX($C$3:$C$6,MATCH("James",$B$3:$B$6,0)):INDEX($C$3:$M$6,MATCH("James",$B$3:$B$6,0),$A$1))
=COUNT(OFFSET($B$2,MATCH("James",$B$3:$B$6,0),1,1,$A$1))

Both end up doing the same thing.
 
Upvote 0
Solution

Forum statistics

Threads
1,214,869
Messages
6,122,012
Members
449,060
Latest member
LinusJE

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