A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Excel » General Discussion
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Lookup function/sum function



 
 
Thread Tools Display Modes
  #1  
Old November 1st, 2006, 01:36 AM posted to microsoft.public.excel.misc
Secret Squirrel
external usenet poster
 
Posts: 683
Default Lookup function/sum function

I have a worksheet (sales orders) that has a list of sales orders that I need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each month
it finds on the sales order worksheet under the correct month.
  #2  
Old November 1st, 2006, 04:09 AM posted to microsoft.public.excel.misc
JMB
external usenet poster
 
Posts: 1,266
Default Lookup function/sum function

Suppose A1 = 11/06 (Date formatted as mm/yy), Sales data is on a tab called
SalesOrders with the dates in A1:A100 and sales in B1:B100:

Try:
=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)), SalesOrders!B1:B100)


"Secret Squirrel" wrote:

I have a worksheet (sales orders) that has a list of sales orders that I need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each month
it finds on the sales order worksheet under the correct month.

  #3  
Old November 1st, 2006, 07:08 AM posted to microsoft.public.excel.misc
Domenic
external usenet poster
 
Posts: 219
Default Lookup function/sum function

Assumptions:

Sheet1!A2:A100 contains the sales order date (true date values)

Sheet1!B2:B100 contains the total price

Sheet2!B11 contains the first day of the month and year of interest,
such as November 1, 2005, December 1, 2006, and January 1, 2006 (format
cells as desired)

Formula:

B2, copied across:

=SUMPRODUCT(--(Sheet1!$A$2:$A$100-DAY(Sheet1!$A$2:$A$100)+1=Sheet2!B$1),S
heet1!$B$2:$B$100)

Change the references accordingly.

Hope this helps!

In article ,
Secret Squirrel wrote:

I have a worksheet (sales orders) that has a list of sales orders that I need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each month
it finds on the sales order worksheet under the correct month.

  #4  
Old November 1st, 2006, 07:33 AM posted to microsoft.public.excel.misc
Nick Hodge
external usenet poster
 
Posts: 614
Default Lookup function/sum function

Use a pivot table

Go to datapivot table chart or report. When asked select Excel data and
select the data you have. Finish the wizard, asking it to place the pivot
table on another sheet.

You should now have a 'shadow' grid. Drag the Date field to the 'Row field'
area and the value field to the 'value' area. Now right click on the date
header in the pivot table and select 'group...'

This will then offer date types to select from, select months and, if the
data is more than one year, select year as well and all should look well.
(As you add data, you will need to extend the range that the data covers, or
set up a dynamic range)

If this makes no sense (It probably doesn't) then read up on pivot tables at
the following

http://www.nickhodge.co.uk/gui/datam...ablereport.htm

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England

HIS
www.nickhodge.co.uk

"Secret Squirrel" wrote in
message news
I have a worksheet (sales orders) that has a list of sales orders that I
need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary
worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each
month
it finds on the sales order worksheet under the correct month.



  #5  
Old November 1st, 2006, 11:33 AM posted to microsoft.public.excel.misc
Secret Squirrel
external usenet poster
 
Posts: 683
Default Lookup function/sum function

That worked perfectly! Thank you!

One follow-up question... Say I want to also have it check another column to
see if there is a certain value in it. For example after it checks the date
have it verify if there is a "1" in column E and then sum just those sales
order totals in column B.
How would I add that to the code you wrote?

"JMB" wrote:

Suppose A1 = 11/06 (Date formatted as mm/yy), Sales data is on a tab called
SalesOrders with the dates in A1:A100 and sales in B1:B100:

Try:
=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)), SalesOrders!B1:B100)


"Secret Squirrel" wrote:

I have a worksheet (sales orders) that has a list of sales orders that I need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each month
it finds on the sales order worksheet under the correct month.

  #6  
Old November 1st, 2006, 10:10 PM posted to microsoft.public.excel.misc
Domenic
external usenet poster
 
Posts: 219
Default Lookup function/sum function

Try...

=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)),--(SalesOrders!E1:E100=1),SalesOrd
ers!B1:B100)

Hope this helps!

In article ,
Secret Squirrel wrote:

That worked perfectly! Thank you!

One follow-up question... Say I want to also have it check another column to
see if there is a certain value in it. For example after it checks the date
have it verify if there is a "1" in column E and then sum just those sales
order totals in column B.
How would I add that to the code you wrote?

"JMB" wrote:

Suppose A1 = 11/06 (Date formatted as mm/yy), Sales data is on a tab called
SalesOrders with the dates in A1:A100 and sales in B1:B100:

Try:
=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)), SalesOrders!B1:B100)


"Secret Squirrel" wrote:

I have a worksheet (sales orders) that has a list of sales orders that I
need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another
that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary
worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each
month
it finds on the sales order worksheet under the correct month.

  #7  
Old November 2nd, 2006, 12:27 AM posted to microsoft.public.excel.misc
Secret Squirrel
external usenet poster
 
Posts: 683
Default Lookup function/sum function

Thanks for the help!

Now a follow-up to my follow-up question.

Say I want to use the same approach but sum the sales in B1:B100 using a
prior date to the current month approach. For example if A1 = 11/06, then I
would want it to look up all the sales dates prior to the current month (not
including the current month) and sum the sales in B1:B100. How would I set
that up?

"Domenic" wrote:

Try...

=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)),--(SalesOrders!E1:E100=1),SalesOrd
ers!B1:B100)

Hope this helps!

In article ,
Secret Squirrel wrote:

That worked perfectly! Thank you!

One follow-up question... Say I want to also have it check another column to
see if there is a certain value in it. For example after it checks the date
have it verify if there is a "1" in column E and then sum just those sales
order totals in column B.
How would I add that to the code you wrote?

"JMB" wrote:

Suppose A1 = 11/06 (Date formatted as mm/yy), Sales data is on a tab called
SalesOrders with the dates in A1:A100 and sales in B1:B100:

Try:
=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)), SalesOrders!B1:B100)


"Secret Squirrel" wrote:

I have a worksheet (sales orders) that has a list of sales orders that I
need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another
that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary
worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each
month
it finds on the sales order worksheet under the correct month.


  #8  
Old November 2nd, 2006, 12:46 AM posted to microsoft.public.excel.misc
JMB
external usenet poster
 
Posts: 1,266
Default Lookup function/sum function

If 11/06 is the date 11/1/06 formatted to display as 11/06 then
=SUMPRODUCT(--(SalesOrders!A1:A100B1), SalesOrders!B1:B100)

If its not 11/1/06 and you have the analysis toolpak installed then
=SUMPRODUCT(--(SalesOrders!A1:A100=EOMONTH(B1,-1)), SalesOrders!B1:B100)

Or, this should work:
=SUMPRODUCT(--(SalesOrders!A1:A100DATE(YEAR(B1), MONTH(B1), 1)),
SalesOrders!B1:B100)



"Secret Squirrel" wrote:

Thanks for the help!

Now a follow-up to my follow-up question.

Say I want to use the same approach but sum the sales in B1:B100 using a
prior date to the current month approach. For example if A1 = 11/06, then I
would want it to look up all the sales dates prior to the current month (not
including the current month) and sum the sales in B1:B100. How would I set
that up?

"Domenic" wrote:

Try...

=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)),--(SalesOrders!E1:E100=1),SalesOrd
ers!B1:B100)

Hope this helps!

In article ,
Secret Squirrel wrote:

That worked perfectly! Thank you!

One follow-up question... Say I want to also have it check another column to
see if there is a certain value in it. For example after it checks the date
have it verify if there is a "1" in column E and then sum just those sales
order totals in column B.
How would I add that to the code you wrote?

"JMB" wrote:

Suppose A1 = 11/06 (Date formatted as mm/yy), Sales data is on a tab called
SalesOrders with the dates in A1:A100 and sales in B1:B100:

Try:
=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)), SalesOrders!B1:B100)


"Secret Squirrel" wrote:

I have a worksheet (sales orders) that has a list of sales orders that I
need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another
that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary
worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each
month
it finds on the sales order worksheet under the correct month.


  #9  
Old November 5th, 2006, 03:04 AM posted to microsoft.public.excel.misc
Secret Squirrel
external usenet poster
 
Posts: 683
Default Lookup function/sum function

That worked great! Thank you!

Next question. lol

This might be a bit more trickier.

In column A I have the order date, in column B the order number, in column D
I have the release number. There is a row for each line item of the sales
order. If the line item has multiple releases it will also list those as
well. It also lists the master release which is the entire quantity ordered
but then below that line it will list each release with the individual
quantites for those releases. So if I add up all the line items for a
specific order then it will actually be double the amount since the master
list is the total quantity. What I want to do is use the same formula you
gave me before but have it look if an order has muliple releases. If it does
then have it add up only the release numbers greater than 0 but also add up
the orders that do not have multipl releases. These would only have a 0 in
the column d. Example:

Column A Column B Column C Column D
11/01/06 217646 $100.00 0 (master release of this order)
11/01/06 217646 $50.00 1 (first release)
11/01/06 217646 $50.00 2 (second release)
11/01/06 216554 $100.00 0 (single release)
12/01/06 321222 $200.00 0 (single release)

So what I want to do is look up all the sales for each month like I did from
your last formula but only add up the sales that have 1 release (column d is
0), and add only the sales that have multiple releases but not use the main
release of 0 for that order.
I hope this makes sense to you.

I greatly appreciate all your help with this.

SS


"Domenic" wrote:

Try...

=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)),--(SalesOrders!E1:E100=1),SalesOrd
ers!B1:B100)

Hope this helps!

In article ,
Secret Squirrel wrote:

That worked perfectly! Thank you!

One follow-up question... Say I want to also have it check another column to
see if there is a certain value in it. For example after it checks the date
have it verify if there is a "1" in column E and then sum just those sales
order totals in column B.
How would I add that to the code you wrote?

"JMB" wrote:

Suppose A1 = 11/06 (Date formatted as mm/yy), Sales data is on a tab called
SalesOrders with the dates in A1:A100 and sales in B1:B100:

Try:
=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)), SalesOrders!B1:B100)


"Secret Squirrel" wrote:

I have a worksheet (sales orders) that has a list of sales orders that I
need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another
that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary
worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each
month
it finds on the sales order worksheet under the correct month.


  #10  
Old November 5th, 2006, 07:01 AM posted to microsoft.public.excel.misc
JMB
external usenet poster
 
Posts: 1,266
Default Lookup function/sum function

Assuming your date 11/06 is in cell F1 and the subsequent releases could be
in a different month from the master release (if the order number appears
once, look for a 0 in column D and if the order number appears more than
once, look for a number greater than 0 in column D), this appeared to work
=SUMPRODUCT(--(MONTH(A1:A5)=MONTH(F1)),--(YEAR(A1:A5)=YEAR(F1)),--(D15=(--(COUNTIF(B1:B5,B1:B5)1))),C1:C5)

array entered w/Cntrl+Shift+Enter

If the master release and the later releases are all in the same month you
could just test column D for 0 (just add the master releases - which would
work for the sample data you've given):
=SUMPRODUCT(--(MONTH(A1:A5)=MONTH(F1)),--(YEAR(A1:A5)=YEAR(F1)),--(D15=0),C1:C5)


entered normally

"Secret Squirrel" wrote:

That worked great! Thank you!

Next question. lol

This might be a bit more trickier.

In column A I have the order date, in column B the order number, in column D
I have the release number. There is a row for each line item of the sales
order. If the line item has multiple releases it will also list those as
well. It also lists the master release which is the entire quantity ordered
but then below that line it will list each release with the individual
quantites for those releases. So if I add up all the line items for a
specific order then it will actually be double the amount since the master
list is the total quantity. What I want to do is use the same formula you
gave me before but have it look if an order has muliple releases. If it does
then have it add up only the release numbers greater than 0 but also add up
the orders that do not have multipl releases. These would only have a 0 in
the column d. Example:

Column A Column B Column C Column D
11/01/06 217646 $100.00 0 (master release of this order)
11/01/06 217646 $50.00 1 (first release)
11/01/06 217646 $50.00 2 (second release)
11/01/06 216554 $100.00 0 (single release)
12/01/06 321222 $200.00 0 (single release)

So what I want to do is look up all the sales for each month like I did from
your last formula but only add up the sales that have 1 release (column d is
0), and add only the sales that have multiple releases but not use the main
release of 0 for that order.
I hope this makes sense to you.

I greatly appreciate all your help with this.

SS


"Domenic" wrote:

Try...

=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)),--(SalesOrders!E1:E100=1),SalesOrd
ers!B1:B100)

Hope this helps!

In article ,
Secret Squirrel wrote:

That worked perfectly! Thank you!

One follow-up question... Say I want to also have it check another column to
see if there is a certain value in it. For example after it checks the date
have it verify if there is a "1" in column E and then sum just those sales
order totals in column B.
How would I add that to the code you wrote?

"JMB" wrote:

Suppose A1 = 11/06 (Date formatted as mm/yy), Sales data is on a tab called
SalesOrders with the dates in A1:A100 and sales in B1:B100:

Try:
=SUMPRODUCT(--(MONTH(SalesOrders!A1:A100)=MONTH(B1)),
--(YEAR(SalesOrders!A1:A100)=YEAR(B1)), SalesOrders!B1:B100)


"Secret Squirrel" wrote:

I have a worksheet (sales orders) that has a list of sales orders that I
need
to total up on a different summary worksheet by month. On the sales order
worksheet I have one column that has the sales order date and another
that
has the total price. What I want to do is have all the sales added up for
each month on another worksheet. The headers I have on the summary
worksheet
are "11/06", "12/06", etc. I want it to just put the summary for each
month
it finds on the sales order worksheet under the correct month.


 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 06:33 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.