kerstinedatu
New Member
- Joined
- Jul 25, 2018
- Messages
- 1
Hi All,
I am currently trying to write a code with SUMIFS formula but I'm having difficulty as I'm still a newbie at VBA.
I tried using other codes from different forums including here but to no avail.
Would also like to know if the code can loop for all blank cells in case other criteria will be added in the future.
Below is a sample of what I'm currently working on.
[TABLE="width: 506"]
<colgroup><col><col><col><col span="3"></colgroup><tbody>[TR]
[TD="colspan: 6"][TABLE="width: 506"]
<colgroup><col><col><col><col span="3"></colgroup><tbody>[TR]
[TD="colspan: 6"]Sheet 1 (Received)[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD] [/TD]
[TD]Total[/TD]
[TD] 1,312.00[/TD]
[TD] 57,206.00[/TD]
[TD] 57,206.00[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD] [/TD]
[TD]Bank[/TD]
[TD]1/1/2018[/TD]
[TD]1/2/2018[/TD]
[TD]1/3/2018[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD]JMC[/TD]
[TD]JP Morgan Chase[/TD]
[TD] 1,000.00[/TD]
[TD] 1,000.00[/TD]
[TD] 1,000.00[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD]BOA[/TD]
[TD]Bank of America[/TD]
[TD] - [/TD]
[TD] 1,000.00[/TD]
[TD] 1,000.00[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD]CG[/TD]
[TD]Citigroup[/TD]
[TD] - [/TD]
[TD] - [/TD]
[TD] - [/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD]WF[/TD]
[TD]Wells Fargo[/TD]
[TD] - [/TD]
[TD] - [/TD]
[TD] - [/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD]GS[/TD]
[TD]Goldman Sachs[/TD]
[TD] 312.00[/TD]
[TD] 312.00[/TD]
[TD] 312.00[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD]MS[/TD]
[TD]Morgan Stanley[/TD]
[TD] - [/TD]
[TD] 54,894.00[/TD]
[TD] 54,894.00[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD]USB[/TD]
[TD]U.S Bancorp[/TD]
[TD] - [/TD]
[TD] - [/TD]
[TD] - [/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD="align: right"][TABLE="width: 462"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD="colspan: 5"]Sheet 2 (Details)[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]Branch[/TD]
[TD]Bank Account[/TD]
[TD]Cheque Amount[/TD]
[TD]Date Received from EO[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]1[/TD]
[TD]JP Morgan Chase[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]1/1/2018[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]1[/TD]
[TD]Bank of America[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]1/2/2018[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]2[/TD]
[TD]Citigroup[/TD]
[TD="align: right"]5000[/TD]
[TD="align: right"]1/4/2018[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD="align: right"]3[/TD]
[TD]Wells Fargo[/TD]
[TD="align: right"]82116[/TD]
[TD="align: right"]1/7/2018[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD="align: right"]1[/TD]
[TD]Goldman Sachs[/TD]
[TD="align: right"]312[/TD]
[TD="align: right"]1/1/2018[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD="align: right"]2[/TD]
[TD]Morgan Stanley[/TD]
[TD="align: right"]54894[/TD]
[TD="align: right"]1/2/2018[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD="align: right"]1[/TD]
[TD]U.S Bancorp[/TD]
[TD="align: right"]16549[/TD]
[TD="align: right"]1/4/2018[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
[/TD]
[/TR]
</tbody>[/TABLE]
Formula from D11 to infinity is =SUMIFS(Details!$D:$D,Details!$C:$C,Received!$C11,Details!$E:$E,Received!D$10)
Formula for D9:_9 is =SUM(D11:D66)
Hope someone can help me.
I am currently trying to write a code with SUMIFS formula but I'm having difficulty as I'm still a newbie at VBA.
I tried using other codes from different forums including here but to no avail.
Would also like to know if the code can loop for all blank cells in case other criteria will be added in the future.
Below is a sample of what I'm currently working on.
[TABLE="width: 506"]
<colgroup><col><col><col><col span="3"></colgroup><tbody>[TR]
[TD="colspan: 6"][TABLE="width: 506"]
<colgroup><col><col><col><col span="3"></colgroup><tbody>[TR]
[TD="colspan: 6"]Sheet 1 (Received)[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[TD]F[/TD]
[/TR]
[TR]
[TD="align: right"]9[/TD]
[TD] [/TD]
[TD]Total[/TD]
[TD] 1,312.00[/TD]
[TD] 57,206.00[/TD]
[TD] 57,206.00[/TD]
[/TR]
[TR]
[TD="align: right"]10[/TD]
[TD] [/TD]
[TD]Bank[/TD]
[TD]1/1/2018[/TD]
[TD]1/2/2018[/TD]
[TD]1/3/2018[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD]JMC[/TD]
[TD]JP Morgan Chase[/TD]
[TD] 1,000.00[/TD]
[TD] 1,000.00[/TD]
[TD] 1,000.00[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD]BOA[/TD]
[TD]Bank of America[/TD]
[TD] - [/TD]
[TD] 1,000.00[/TD]
[TD] 1,000.00[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD]CG[/TD]
[TD]Citigroup[/TD]
[TD] - [/TD]
[TD] - [/TD]
[TD] - [/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD]WF[/TD]
[TD]Wells Fargo[/TD]
[TD] - [/TD]
[TD] - [/TD]
[TD] - [/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD]GS[/TD]
[TD]Goldman Sachs[/TD]
[TD] 312.00[/TD]
[TD] 312.00[/TD]
[TD] 312.00[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD]MS[/TD]
[TD]Morgan Stanley[/TD]
[TD] - [/TD]
[TD] 54,894.00[/TD]
[TD] 54,894.00[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD]USB[/TD]
[TD]U.S Bancorp[/TD]
[TD] - [/TD]
[TD] - [/TD]
[TD] - [/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[/TR]
[TR]
[TD="align: right"][TABLE="width: 462"]
<colgroup><col><col><col><col><col></colgroup><tbody>[TR]
[TD="colspan: 5"]Sheet 2 (Details)[/TD]
[/TR]
[TR]
[TD]A[/TD]
[TD]B[/TD]
[TD]C[/TD]
[TD]D[/TD]
[TD]E[/TD]
[/TR]
[TR]
[TD]10[/TD]
[TD]Branch[/TD]
[TD]Bank Account[/TD]
[TD]Cheque Amount[/TD]
[TD]Date Received from EO[/TD]
[/TR]
[TR]
[TD="align: right"]11[/TD]
[TD="align: right"]1[/TD]
[TD]JP Morgan Chase[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]1/1/2018[/TD]
[/TR]
[TR]
[TD="align: right"]12[/TD]
[TD="align: right"]1[/TD]
[TD]Bank of America[/TD]
[TD="align: right"]1000[/TD]
[TD="align: right"]1/2/2018[/TD]
[/TR]
[TR]
[TD="align: right"]13[/TD]
[TD="align: right"]2[/TD]
[TD]Citigroup[/TD]
[TD="align: right"]5000[/TD]
[TD="align: right"]1/4/2018[/TD]
[/TR]
[TR]
[TD="align: right"]14[/TD]
[TD="align: right"]3[/TD]
[TD]Wells Fargo[/TD]
[TD="align: right"]82116[/TD]
[TD="align: right"]1/7/2018[/TD]
[/TR]
[TR]
[TD="align: right"]15[/TD]
[TD="align: right"]1[/TD]
[TD]Goldman Sachs[/TD]
[TD="align: right"]312[/TD]
[TD="align: right"]1/1/2018[/TD]
[/TR]
[TR]
[TD="align: right"]16[/TD]
[TD="align: right"]2[/TD]
[TD]Morgan Stanley[/TD]
[TD="align: right"]54894[/TD]
[TD="align: right"]1/2/2018[/TD]
[/TR]
[TR]
[TD="align: right"]17[/TD]
[TD="align: right"]1[/TD]
[TD]U.S Bancorp[/TD]
[TD="align: right"]16549[/TD]
[TD="align: right"]1/4/2018[/TD]
[/TR]
</tbody>[/TABLE]
[/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD][/TD]
[TD]
[/TD]
[/TR]
</tbody>[/TABLE]
Formula from D11 to infinity is =SUMIFS(Details!$D:$D,Details!$C:$C,Received!$C11,Details!$E:$E,Received!D$10)
Formula for D9:_9 is =SUM(D11:D66)
Hope someone can help me.