-1
私は性別が男性と自分の年齢である(私の例では)従業員の数を計算するためにCOUNTIFステートメントを使用したいが、私は制限を追加しCOUNTIFのステートメントに別の引数を追加する方法を確認していない30〜15の間にあります2つのステートメントだけを取るので、ジェンダーのVBAで2つ以上の引数を持つcountifを使用するには?
Function Calculate(Column_target As Integer, Row_number As Double, Level_of_response As Integer, Column_of_reference As Integer, level_of_reference As Integer) As Double
Sheets("A").Select
Range(Cells(2, Column_target), Cells(Row_number , Column_target)).Select
For i = 3 To Row_number + 1
If (Level_of_response = 1) Then
Calculate = (Application.WorksheetFunction.CountIf(Selection, "<31") - Application.WorksheetFunction.CountIf(Selection, "<15"))/(Row_number - 1)
End If
これは私がCOUNTIF文の第三引数として追加するコードは次のとおりです。 はここに私の機能コードです。
(Cells(i, Column_of_reference) = level_of_reference)
'これはlevel_of_reference 1(又は2)である場合に性別が男性(または女性)であることを示しています。
できません「のERROがありますワークシート関数クラスのcountifプロパティを取得する "! – Zapata
@ Zapata - おそらく[this](http://stackoverflow.com/a/12009904/2707864)が役に立ちます。 –
@Zapataまたはこれ[http://www.mrexcel .COM /フォーラム/エクセル-質問/ 584979-ランタイムエラー-1004--COUNTIF-プロパティworksheetfunctionクラス-ください-help.htmlができます)。 'てみApplication.CountIfs(...' 'ではなくアプリケーションの.WorksheetFunction.CountIfs(... '。 –