• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Is there a macro that will compute values for weekends only?

I attached here the sample workbook that has formulas :
=SUM(B2;B5:B9;B12:B16;B19:B23;B26:B30)

which sums values for weekdays, and formula:

=SUM(B3:B4;B10:B11;B17:B18;B24:B25;B31:B32)

which sums values for weekdays. Is there anyway to code that in macro? A code that will automatically sum values for weekends, and separately for weekdays, in any month? I hope you can help me. Thank you so much!!! :)
 

Attachments

  • MyProject.xlsx
    10 KB · Views: 0
Hi ,

See the attached file.

The function is a UDF , called CalculateSums , and can be called in 3 different ways :

=CalculateSums(DatesRange , ValuesRange) ---- this will just sum up all the values

=CalculateSums(DatesRange , ValuesRange , True) ---- this will sum up the values for all weekdays

=CalculateSums(DatesRange , ValuesRange , False) ---- this will sum up the values for all weekends

Narayan
 

Attachments

  • MyProject.xlsm
    15.2 KB · Views: 1
Hi ,

See the attached file.

The function is a UDF , called CalculateSums , and can be called in 3 different ways :

=CalculateSums(DatesRange , ValuesRange) ---- this will just sum up all the values

=CalculateSums(DatesRange , ValuesRange , True) ---- this will sum up the values for all weekdays

=CalculateSums(DatesRange , ValuesRange , False) ---- this will sum up the values for all weekends

Narayan
Thank You Narayan!!! Works like magic! :) You are a genius!
 
Back
Top