Countif to stop counting.

Roamingsmile

New Member
Joined
Feb 26, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
Hi everyone, a new user here...

I’ve got a cell (g3) which contains the following-

COUNTIF(‘D1’!A41:N45, “1.1.2”)

1.1.2 can be entered unlimited times on the other sheet which Is fine and returns my count.

however this number needs to only be counted up to 2.

I gather it needs to be some sort of min(countif but I can’t work exactly.

this is one of many of my problems as I’m making (what I think lol) is a complex workbook! So if anyone wants to help, I’d be appreciative!
 

Excel Facts

Enter current date or time
Ctrl+: enters current time. Ctrl+; enters current date. Use Ctrl+: Ctrl+; Enter for current date & time.
Welcome to the forum!

Try:

=MIN(COUNTIF(‘D1’!A41:N45, “1.1.2”), 2)
 
Upvote 0
Solution
Ah so, I realised after that this formula needs to count from multiple pages... it doesn’t like it if I make countif into countifs and add multiple criteria, it brings up the NAME error. I assume it’s trying to find the 1.1.2 on every sheet which it won’t find?
 
Upvote 0
You're looking on multiple sheets? You may need to have a list of the sheets. Then you can use a formula like this:

Book1
AB
13D1
22D2
3D3
D2
Cell Formulas
RangeFormula
A1A1=SUMPRODUCT(COUNTIF(INDIRECT("'"&B1:B3&"'!A41:N45"),"1.1.2"))
A2A2=MIN(SUMPRODUCT(COUNTIF(INDIRECT("'"&B1:B3&"'!A41:N45"),"1.1.2")),2)
 
Upvote 0

Forum statistics

Threads
1,214,525
Messages
6,120,051
Members
448,940
Latest member
mdusw

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