• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

COUNTIFS VBA Macro

Vijaychitra

New Member
Hi,

I'm able to get COUNTIFS results when the below formula's used in excel cell.

2 sheets are referred

=COUNTIFS('Sheet2'!L2:L1000,">90",'Sheet2'!F2:F1000,'Sheet1'!B5)
=COUNTIFS('Sheet2'!L2:L1000,">=3",'Sheet2'!L2:L1000,"<=5",'Sheet2'!F2:F1000,'Sheet1'!B5)

However, when tried to use the same formula in VBA, it doesn't return value/ unable to execute.
I have added " " to compile, no luck.
 

Marc L

Excel Ninja
Hi, according to Excel / VBA basics :​
Code:
Sub Demo1()
    MsgBox [COUNTIFS('Sheet2'!L2:L1000,">90",'Sheet2'!F2:F1000,'Sheet1'!B5)]
    MsgBox [COUNTIFS('Sheet2'!L2:L1000,">=3",'Sheet2'!L2:L1000,"<=5",'Sheet2'!F2:F1000,'Sheet1'!B5]
End Sub
Do you like it ? So thanks to click on bottom right Like !​
 
Top