WorksheetFunction.CountIf, with non-numeric

London_Calling

Active Member
Joined
Feb 27, 2007
Messages
256
These things drive me utterly bonkers - playing 'where to put the quotes' is like playing battleships as a kid. I've given it a decent go this morning, I'm hoping one of you have better luck....

Code:
totalNonNumeric = WorksheetFunction.CountIf(Range(("Cells(i + UBound(resultsArr1) - totalMatches - 1, colA), Cells(UBound(resultsArr1) + i, colA"), "/")))

Fwiw, I started out with a working WorksheetFunction.Sum variation:
Code:
calanderLiability = WorksheetFunction.Sum(Range(Cells(i + UBound(resultsArr1) - totalMatches - 1, colA), Cells(UBound(resultsArr1) + i, colA)))

I've been looking at colon instead of comma, where to put brackets and where to put quotation marks.... Any ideas gratefully received...
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Perhaps this:

Code:
totalNonNumeric = WorksheetFunction.CountIf(Range(Cells(i + UBound(resultsArr1) - totalMatches - 1, "A"), Cells(UBound(resultsArr1) + i, "A")), "/")
 
Upvote 0
Richard,

Thanks for looking in. It took me a moment to see what you'd done there!

I should have been clearer; 'colA' and 'colB' are (inappropriately named) variables. I'll restate it to aviod unnecessary confusion:

Code:
totalNonNumeric = WorksheetFunction.Sum(Range(Cells(i + UBound(resultsArr1), varA), Cells(UBound(resultsArr1), varA)))
^ This obv. is fine as it's SUM with appropriate args.

Converting it to COUNTIF is where I'm stuck:
Code:
totalNonNumeric = WorksheetFunction.CountIf(Range(Cells(i + UBound(resultsArr1), varA):Cells(UBound(resultsArr1), varA, "/")))
^ rubbish

As mentioned, I think it's just getting the colon or comma right, the brackets or quotation marks.... hope that's a bit simpler ...
 
Upvote 0

Forum statistics

Threads
1,224,585
Messages
6,179,696
Members
452,938
Latest member
babeneker

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