简体   繁体   中英

Syntax error CountIfs-function multiple criteria

I would like to use a CountIfs-function with two criterias. My programm should go through two different columns and compare the cells. I used this code:

WorksheetFunction.CountIfs(Data:E;E;"=Open":Daten;Q:Q;"=company")

Could you please tell me if it is possible to use the CountIfs-function like that? Because my compiler is dropping a syntax-error.

Thanks a lot!

Is this what you are trying?

Option Explicit

Sub Sample()
    Dim ws As Worksheet
    Set ws = ThisWorkbook.Sheets("Date")
    
    Dim wksFn As WorksheetFunction
    Set wksFn = Application.WorksheetFunction
    
    Debug.Print wksFn.CountIfs(ws.Columns(5), "Open", ws.Columns(17), "company")
End Sub

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM