#### Topic: Macro for count of the total with conditions

Kind !
I with macroes while on you and consequently ask to help. The task such:
"To write a macro the total of payments on the client specified in cell B5 for month, specified in cell A5 will be which result of operation. To place this total of a cell"
The file attached.
Level of knowledge is considered basic, but at me and such is not present. Not so I understand, how it is possible to connect month and date that the formula considered. In advance thanks all.

#### Re: Macro for count of the total with conditions

And  here a macro? For eyes there is enough function  ().

Akina,

Agent_MC wrote:

to Write a macro

the student...

#### Re: Macro for count of the total with conditions

Agent_MC;
In cycle For you sort out all clients, in a cycle you write condition If, i.e. if, the title of the client from Jach B5 coincided with the client in a cycle (row number), then one more condition if and in it through Instr (you find coincidence on value "." And month of search and ".") or Mid (a cell, 4,2) you compare value that in cell A5 (if month is registered also by number) if coincidence is in the counter of the totals you add the found. And as a result you deduce in  5. Like all would tell, it is necessary to write the code

#### Re: Macro for count of the total with conditions

Agent_MC;
Not clearly, how month - number, is set by a title? In an amicable way it should be +. But we admit for simplicity that month is set by number. Then the task dares the formula

`` = ((MONTH (A12:A38) =A5) * (B12:B38=B5); C12:C38) ``

The same a macro

``````Sub bb ()
[C5] = [SUMPRODUCT ((MONTH (A12:A38) =A5) * (B12:B38=B5), C12:C38)]
End Sub``````