Countif

Deano

Active Member
Joined
May 2, 2004
Messages
264
Hi

Assuming I have a file with many rows or product codes and want to count the number of times each product code is duplicated and insert this value into a column in the data, I would use the COUNIF formula. Now if I want this to be modified to only count the visible rows when I apply filtering, can anyone tell me how to modify my formula?

Regards
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.

Aladin Akyurek

MrExcel MVP
Joined
Feb 14, 2002
Messages
85,210
Hi

Assuming I have a file with many rows or product codes and want to count the number of times each product code is duplicated and insert this value into a column in the data, I would use the COUNIF formula. Now if I want this to be modified to only count the visible rows when I apply filtering, can anyone tell me how to modify my formula?

Regards

=SUMPRODUCT(SUBTOTAL(3,OFFSET(F5:F600,ROW(F5:F600)-ROW(F5),,1)),--(F5:F600=ProdCode))

Adjust the range to suit.
 

Deano

Active Member
Joined
May 2, 2004
Messages
264
Hi Fazza

I thought of this, but using the subtotal within the rows of data seems a bit tough? I normally use subtotal(3,etc) outside the "database" and not inside it. What's your suggestion??
 

Fazza

MrExcel MVP
Joined
May 17, 2006
Messages
9,368
Hi Deano,

I didn't initially understand about wanting the result within the data - I thought/assumed it was at the bottom. So, please disregard my suggestion.

FWIW, it does sound though that inputs and reporting are being mixed up together. If there is significant data or the reporting becomes too difficult, you might consider having a dedicated data input section and a separate output/report section.

Beer o'clock for me. Regards, Fazza
 

Forum statistics

Threads
1,181,102
Messages
5,928,073
Members
436,587
Latest member
Slicesofquince

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
Top