VBA or SUMIFs

needtoknownow

New Member
Joined
Apr 28, 2013
Messages
17
I need to be able to sum the SALES_UNITS based on two Criteria.
Criteria 1 is the name and criteria 2 is the last 7 days. Could you please help me write a formula using VBA if possible? For example I want to be able to enter the name Mike into Range("C2") on Sheet2! and have the Sum of the sales units for the previous 7 days populate into Range("C3") and the Sum of the 7 day before that populate into Range("C4").
Thank You.



Here is an example of the table (This table updates daily onto Sheet1!)

A B C
REPAPPROVAL_DATESALES_UNITS
Mike4/1/2013 0:0021
Mike4/2/2013 0:0043
Mike4/3/2013 0:003
Mike4/24/2013 0:002
Mike4/25/2013 0:0032
Mike4/27/2013 0:0054
Mike4/27/2013 0:0023
Mike4/8/2013 0:0043
Mike4/9/2013 0:0054
Mike4/10/2013 0:0023
Mike4/11/2013 0:004
Mike4/12/2013 0:0034
James4/13/2013 0:0044
James4/14/2013 0:0043
James4/15/2013 0:0043
James4/16/2013 0:0034
James4/17/2013 0:0032
James4/18/2013 0:0043
James4/19/2013 0:0023
James4/20/2013 0:005
James4/21/2013 0:004
James4/22/2013 0:002
Kathy4/23/2013 0:003
Kathy4/24/2013 0:0043
Kathy4/25/2013 0:0065
Kathy4/26/2013 0:0034
Kathy4/27/2013 0:0032
Kathy4/25/2013 0:0034
Kathy4/26/2013 0:0054
Kathy4/26/2013 0:0031
Kathy4/1/2013 0:0054
Kathy4/2/2013 0:0076
Kathy4/3/2013 0:0054
Kathy4/4/2013 0:0032
Kathy4/5/2013 0:0032
Kathy4/6/2013 0:0065
Kathy4/7/2013 0:0043
Kathy4/8/2013 0:0032
Kathy4/9/2013 0:00525
Kathy4/10/2013 0:0063

<tbody>
</tbody><colgroup><col><col><col></colgroup>
 

Excel Facts

How can you turn a range sideways?
Copy the range. Select a blank cell. Right-click, Paste Special, then choose Transpose.
this is if the name of the sheet that has the data is sheet1
Code:
=SUMIFS(Sheet1!$C$3:$C$42,Sheet1!$B$3:$B$42,"<="&TODAY(),Sheet1!$B$3:$B$42,">="&TODAY()-7,Sheet1!$A$3:$A$42,Sheet2!C2)
 
Upvote 0
this is if the name of the sheet that has the data is sheet1
Code:
=SUMIFS(Sheet1!$C$3:$C$42,Sheet1!$B$3:$B$42,"<="&TODAY(),Sheet1!$B$3:$B$42,">="&TODAY()-7,Sheet1!$A$3:$A$42,Sheet2!C2)



You are a AWESOME!!!!!! The entire time i have been trying this and never once thought to use an & symbol. Thank you so very much. I have been watching videos and reading books all day trying to do it myself. my pride usallally does not allow me to ask for help but I am glad I did. Thank you again.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,716
Members
448,985
Latest member
chocbudda

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