Trying to figure out how I can sumifs the total "target" figures for weekdays, and the total "target" figures for " Sat" & "sun"

Dave01

Board Regular
Joined
Nov 30, 2018
Messages
116
Office Version
  1. 2019
  2. 2016
Platform
  1. Windows
Hi,

I built a target and result for our purchase ledger team, which worked really well as it only considered working days throughout the month daily. The AP Manager would enter a target figure into the green sections, then enter the actually result of the number processed in the Result column, this would be done daily.

Total targets for the month would just look for the columns called Target and add up the row, the same applies for the Result. This worked really well as it was set up Monday to Friday.
Now he wants to extend this to Saturday and Sunday, but wants to record the target figure and Result figures separate to the weekday figures, and now Im stuck on how to separate the sumifs as before it would just add the row up for target and results.

The spreadsheet can be found here This spreadsheet template

so

data is entered in the green sections under Target and Result
the totals are added up in the blue sections

Weekend doesnt work - but the total will include both Sat & Sunday for both Target and Result

Please could you help resolve the weekend formula

Thaks

David.
 

Attachments

  • 1.JPG
    1.JPG
    130 KB · Views: 6

Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
There is no realistic way to identify weekday using SUMIF(s) or similar functions, SUMPRODUCT is probably the easiest way to do what you need.

This formula will pull the target figure for weekdays and can be easily adjusted for the other 3 columns.

=SUMPRODUCT(($D$4:$BI$4='target Template.xlsx'!Target)*(WEEKDAY($D$3:$BI$3,2)<=5),D5:BI5)

<=5 for weekdays, >=6 for weekends.
 
Upvote 0
works fantastic thank you, spend the last fe hours trying to get it to do that.
 
Upvote 0
There is no realistic way to identify weekday using SUMIF(s) or similar functions, SUMPRODUCT is probably the easiest way to do what you need.

This formula will pull the target figure for weekdays and can be easily adjusted for the other 3 columns.

=SUMPRODUCT(($D$4:$BI$4='target Template.xlsx'!Target)*(WEEKDAY($D$3:$BI$3,2)<=5),D5:BI5)

<=5 for weekdays, >=6 for weekends.


It works really well, but I am not understanding how it links

=SUMPRODUCT(($D$4:$BI$4=Target)*(WEEKDAY($D$3:$BI$3,2)>=6),D5:BI5)


I moved it over to my live spreadsheet and I can see that its linked to the Target Column, when I move it to the results column, it calculated the results column correctly, but I dont understand why as the target column is named target, but the results column is called results.

can you explain why its working?

thanks

david
 
Upvote 0
Ok sorry what I meant was why is the formula working in both columns but the = target does not change. If i do change it to result it doesn't work.
 
Upvote 0
I didn't make the column on the results absolute, which means that when you drag the formula it offsets the values by one column. This wasn't actually intentional, but it works better because I forgot to allow for your merged columns.

If you want to set the criteria correctly for clarity then you would need to use the following, notice that the ranges are different in the second formula.

=SUMPRODUCT(($D$4:$BI$4='target Template.xlsx'!Target)*(WEEKDAY($D$3:$BI$3,2)<=5),$D5:$BI5)

=SUMPRODUCT(($E$4:$BJ$4='target Template.xlsx'!Result)*(WEEKDAY($D$3:$BI$3,2)<=5),$E5:$BJ5)

When you merge 2 or more cells, only the one in the top right corner contains a value for formula purposes, the rest are empty. This means that to get the result from BI5 you have to compare the word Result in BI4 to the date in BH3, if the formula looks at BH4 for the date it will see nothing.
 
Upvote 0
Hi, Thanks for coming back, I tried changing the formula to include the Results, but when I change the formula to Results it either comes up blank a zero or causes an error. For some reason and I can not figure out is why if you reference to Target, both the Target and Results calculate correctly. Its like using an If statement saying if its under target, sum all the target and if its not, sum all the results.

Ive been playing around with it since last night, but the result reference just wont work.


Heres a copy of the updated version, look at the Aug tab, and youll see what I mean, Im stumped on why it works, because the Results column just shouldnt work.


New updated spreadsheet Here

Really thankful for your help here.
 
Upvote 0
Not sure what you've done, but using the formulas in post 6 the results appear to be correct.

Note that 2 of the ranges are different in the result formula to allow for the dates being in merged cells.

Cell Formulas
RangeFormula
BL5:BL22BL5=A5
BM5:BM22BM5=SUMPRODUCT(($D$4:$BI$4='target Template.xlsx'!Target)*(WEEKDAY($D$3:$BI$3,2)>=6),$D5:$BI5)
BN5:BN22BN5=SUMPRODUCT(($E$4:$BJ$4='target Template.xlsx'!Result)*(WEEKDAY($D$3:$BI$3,2)>=6),$E5:$BJ5)
BO5:BO22BO5=SUMPRODUCT(($D$4:$BI$4='target Template.xlsx'!Target)*(WEEKDAY($D$3:$BI$3,2)<=5),$D5:$BI5)
BP5:BP22BP5=SUMPRODUCT(($E$4:$BJ$4='target Template.xlsx'!Result)*(WEEKDAY($D$3:$BI$3,2)<=5),$E5:$BJ5)
BQ5:BR22BQ5=BM5+BO5
BS5:BS22BS5=IF(BR5>BQ5,BR5-BQ5,-BQ5--BR5)
BT5:BT22BT5=IF(BS5>0,OT,IF(BS5=0,Match,UT))
BM24:BS24BM24=SUM(BM5:BM23)
BT24BT24=IF(BS24>0,Maintenance!$E$2,IF(BS24=0,Maintenance!$E$4,Maintenance!$E$3))
 
Upvote 0
HMM this is strange, if you look at the file test, I tried to put your Result formula in, and they are exactly the same as yours, but it didnt work, keeping them both as target worked great, for both Target and Results.

test file here
 
Upvote 0
Not sure if it's the wrong link or of you forgot to save it but test file linked in your last reply still contains the Target formula in both and the results as in my previous post.
 
Upvote 0

Forum statistics

Threads
1,215,220
Messages
6,123,693
Members
449,117
Latest member
Aaagu

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