Slightly odd Count question

phillippaige

New Member
Joined
Dec 2, 2020
Messages
3
Office Version
  1. 365
Platform
  1. Windows
I have a large (100k rows) dataset with a set of about 10 columns. I need a formula to search those columns for a given value (which will then be something that gets repeated about 200 times for different values) and return the number of rows on which it finds that value in any of the 10 columns.

However the data is such that on some rows, the value may appear in only 1 column, whereas on others the value will appear 2-3 times on the same row in differing columns. I need it to only count rows where that multiple occurrence happens as 1 instance.

Any smart way of doing this other than a rather nasty (and slow) loop in VBA? All help much appreciated!
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number
Can you add a column with a formula that just returns a 1 if the value is present in each row? Then all you need to do is sum that column.
 
Upvote 0
Thanks Rory, I absolutely could, though given I'm looping 200 times against what would then be 100k formulae I'm thinking performance might be a bit iffy. Was hoping there was some kind of array style of count but which would check presence in a row.
 
Upvote 0
I think you're looking for something along the line of:
{=SUM(--(MMULT(--(A1:F12="yes"),TRANSPOSE(COLUMN(A1:F12)))>0))}
where "yes" is the value you're looking for and of course set the range to your entire range.
NOTE: This is an array formula.
 
Upvote 0
Solution

Forum statistics

Threads
1,224,814
Messages
6,181,120
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