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:
Custodian 1</SPAN>Today's Date</SPAN>Defi Population</SPAN>Order AgeMethod</SPAN>Reject Population</SPAN>QtyDay</SPAN>Week</SPAN>Month</SPAN>
CustA10/1/2012</SPAN>Active Others</SPAN>6 to 10 days</SPAN>Rejected</SPAN>Electronic</SPAN>4</SPAN>Monday, 10/1/2012</SPAN>Week of 9/28 - 10/4 2012</SPAN>1-Oct-12</SPAN>
CustB10/1/2012</SPAN>Active Others</SPAN>6 to 10 days</SPAN>Not ReceivedElectronic</SPAN>9</SPAN>Tuesday, 10/2/2012</SPAN>Week of 9/28 - 10/4 2012</SPAN>1-Oct-12</SPAN>

<TBODY>
</TBODY><COLGROUP><COL><COL><COL><COL><COL span=2><COL><COL><COL><COL></COLGROUP>
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
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:
1-Oct-12. This is the area that is a problem. It's driving me nuts :(</SPAN>

<TBODY>
</TBODY>


</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,214,648
Messages
6,120,725
Members
448,987
Latest member
marion_davis

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