SUMIFS returns "0" incorrectly. How do I adjust Cell in VBA to return actual sum value?

u228018

New Member
Joined
Jan 2, 2013
Messages
3
I made the following formula to automatically update a report to return Day, Week or Monthly values based on Cell B2 (Which changes based on user input from userform)

=SUMIFS(Qty,Custodian,$B10,Defi,"Active Others",Age,C$4,Method,"Electronic",Rec_Rej,$C$3,day,$A$2). The columns have defined names which match the formula above. My issue is with the "day", "week", and "month" changes. Something happens that when it switches from "month" to "day" the formula breaks and simply returns "0" despite the actual sum being a value much higher. I know this has something to do with text-columns, but I am utterly confused on how to correct it. Once I understand how to manually correct it each time, I can easily correct my userform vba. Please help.

this formula is pulling from a data page that looks like this:
[TABLE="width: 1459"]
<TBODY>[TR]
[TD]Custodian 1</SPAN>[/TD]
[TD]Today's Date</SPAN>[/TD]
[TD]Defi Population</SPAN>[/TD]
[TD]Order Age[/TD]
[TD]Method</SPAN>[/TD]
[TD]Reject Population</SPAN>[/TD]
[TD]Qty[/TD]
[TD]Day</SPAN>[/TD]
[TD]Week</SPAN>[/TD]
[TD]Month</SPAN>[/TD]
[/TR]
[TR]
[TD]CustA[/TD]
[TD]10/1/2012</SPAN>[/TD]
[TD]Active Others</SPAN>[/TD]
[TD]6 to 10 days</SPAN>[/TD]
[TD]Rejected</SPAN>[/TD]
[TD]Electronic</SPAN>[/TD]
[TD]4</SPAN>[/TD]
[TD]Monday, 10/1/2012</SPAN>[/TD]
[TD]Week of 9/28 - 10/4 2012</SPAN>[/TD]
[TD]1-Oct-12</SPAN>[/TD]
[/TR]
[TR]
[TD]CustB[/TD]
[TD]10/1/2012</SPAN>[/TD]
[TD]Active Others</SPAN>[/TD]
[TD]6 to 10 days</SPAN>[/TD]
[TD]Not Received[/TD]
[TD]Electronic</SPAN>[/TD]
[TD]9</SPAN>[/TD]
[TD]Tuesday, 10/2/2012</SPAN>[/TD]
[TD]Week of 9/28 - 10/4 2012</SPAN>[/TD]
[TD]1-Oct-12</SPAN>[/TD]
[/TR]
</TBODY><COLGROUP><COL><COL><COL><COL><COL span=2><COL><COL><COL><COL></COLGROUP>[/TABLE]
 

Excel Facts

What is the shortcut key for Format Selection?
Ctrl+1 (the number one) will open the Format dialog for whatever is selected.
I mistakenly said cell B2 above. The cell that changes each time is reference $A$2 (To either: day: Monday, 10/1/2012, week: Week of 9/28 - 10/4 2012</SPAN>, or month: [TABLE="class: cms_table"]
<TBODY>[TR]
[TD]1-Oct-12. This is the area that is a problem. It's driving me nuts :(</SPAN>[/TD]
[/TR]
</TBODY>[/TABLE]


</SPAN></SPAN>
 
Upvote 0
I figured it out. I was confusing excel by defining my columns as "day" "week" "Month", etc. I fixed this by re-defining them as "day_lkp", "month_lkp", and "week_lkp".
The below formula works now:
=SUMIFS(Qty,Custodian,$B6,Defi,"Active WFDC",Age,C$4,Method,"Electronic",Rec_Rej,$C$3,Month_Lkp,A2)
 
Upvote 0

Forum statistics

Threads
1,223,231
Messages
6,170,884
Members
452,364
Latest member
springate

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top