Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
FBS
 
Posts: n/a
Default Sum of Columns with Calendar Dates and Data

I have two columns in excel that gets its data from an access database. The
two columns are Calendar dates and the other numbers, I would like to have a
formula in a second worksheet that looks up a range of dates i.e.; March
Sales and displays a sum of the corresponding figures in the second column.--
do it right, do it once
  #2   Report Post  
Bob Phillips
 
Posts: n/a
Default

=SUMPRODUCT(--(MONTH(Sheet1!A1:A100)=1),Sheet1!B1:B100)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"FBS" wrote in message
...
I have two columns in excel that gets its data from an access database.

The
two columns are Calendar dates and the other numbers, I would like to have

a
formula in a second worksheet that looks up a range of dates i.e.; March
Sales and displays a sum of the corresponding figures in the second

column.--
do it right, do it once



  #3   Report Post  
FBS
 
Posts: n/a
Default

Thank you Bob for the quick responce, the formula gives me an error
#NAME?
what is the cause? any thoughts?

"Bob Phillips" wrote:

=SUMPRODUCT(--(MONTH(Sheet1!A1:A100)=1),Sheet1!B1:B100)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"FBS" wrote in message
...
I have two columns in excel that gets its data from an access database.

The
two columns are Calendar dates and the other numbers, I would like to have

a
formula in a second worksheet that looks up a range of dates i.e.; March
Sales and displays a sum of the corresponding figures in the second

column.--
do it right, do it once




  #4   Report Post  
Bob Phillips
 
Posts: n/a
Default

Not really, it does work I tested it.

#NAME usually means that it doesn't recognise one on the words, and there is
only SUMPRODUCT and MONTH in there that it might not. Check that there are
no spurious - that crept into the copy, there should only be two, just
before the (MONTH

--

HTH

RP
(remove nothere from the email address if mailing direct)


"FBS" wrote in message
...
Thank you Bob for the quick responce, the formula gives me an error
#NAME?
what is the cause? any thoughts?

"Bob Phillips" wrote:

=SUMPRODUCT(--(MONTH(Sheet1!A1:A100)=1),Sheet1!B1:B100)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"FBS" wrote in message
...
I have two columns in excel that gets its data from an access

database.
The
two columns are Calendar dates and the other numbers, I would like to

have
a
formula in a second worksheet that looks up a range of dates i.e.;

March
Sales and displays a sum of the corresponding figures in the second

column.--
do it right, do it once






  #5   Report Post  
FBS
 
Posts: n/a
Default

Right Bob it does work, Thanks
At first I wanted to select the whole column as a range as in this sample
=SUMPRODUCT(--(MONTH(Sheet2!A:A)=1),Sheet2!E:E), this did not work, I had to
fix cell position as shown in your sample above.
I wanted the select the cell column because the Data that I am refreshing
"from an external source" is set to change with every refresh. Looks I will
have to fix this in another way so the data stays put in the same cell of the
excel worksheet.

"Bob Phillips" wrote:

Not really, it does work I tested it.

#NAME usually means that it doesn't recognise one on the words, and there is
only SUMPRODUCT and MONTH in there that it might not. Check that there are
no spurious - that crept into the copy, there should only be two, just
before the (MONTH

--

HTH

RP
(remove nothere from the email address if mailing direct)


"FBS" wrote in message
...
Thank you Bob for the quick responce, the formula gives me an error
#NAME?
what is the cause? any thoughts?

"Bob Phillips" wrote:

=SUMPRODUCT(--(MONTH(Sheet1!A1:A100)=1),Sheet1!B1:B100)

--

HTH

RP
(remove nothere from the email address if mailing direct)


"FBS" wrote in message
...
I have two columns in excel that gets its data from an access

database.
The
two columns are Calendar dates and the other numbers, I would like to

have
a
formula in a second worksheet that looks up a range of dates i.e.;

March
Sales and displays a sum of the corresponding figures in the second
column.--
do it right, do it once








  #6   Report Post  
Max
 
Posts: n/a
Default

=SUMPRODUCT(--(MONTH(Sheet2!A:A)=1),Sheet2!E:E),
this did not work


Entire col references aren't accepted in SUMPRODUCT

But you could use something like:

=SUMPRODUCT(--(MONTH(Sheet2!A1:A65535)=1),Sheet2!E1:E65535)

albeit this comes with quite a performance hit (slow calcs)

Maybe more viable if you were to reduce the "65535" in the formula to the
*smallest* max number of data rows expected in cols A and E in Sheet2, say
to 10000 or so ??

Another way to play it, if there's *no blank rows* in between the source
data, is to use dynamic ranges for cols A and E in Sheet2

Click Insert Name Define

Under Names in workbook, enter a name: Mth (say)

Put in the "Refers to" box :
=OFFSET(Sheet2!$A$1,,,COUNTA(Sheet2!$A:$A))

Click Add
(this creates a dynamic range for col A in Sheet2)

Repeat the steps above to make
another dynamic range for col E in Sheet2, viz.:

Clear and input for the name: Val (say)
Refers to:
=OFFSET(Sheet2!$E$1,,,COUNTA(Sheet2!$E:$E))

Now you can use this formula instead:
=SUMPRODUCT(--(MONTH(Mth)=1),Val)

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"FBS" wrote in message
...
Right Bob it does work, Thanks
At first I wanted to select the whole column as a range as in this sample
=SUMPRODUCT(--(MONTH(Sheet2!A:A)=1),Sheet2!E:E), this did not work, I had

to
fix cell position as shown in your sample above.
I wanted the select the cell column because the Data that I am refreshing
"from an external source" is set to change with every refresh. Looks I

will
have to fix this in another way so the data stays put in the same cell of

the
excel worksheet.



  #7   Report Post  
Bob Phillips
 
Posts: n/a
Default

Although I would do it the way that Max suggested, with a named range, you
can actually bypass that step, by using the dynamic range directly, i.e.

OFFSET(Sheet2!$A$1,,,COUNTA(Sheet2!$A:$A))

=SUMPRODUCT(--(MONTH(OFFSET(Sheet2!$A$1,,,COUNTA(Sheet2!$A:$A))) =1),OFFSET(S
heet2!$E$1,,,COUNTA(Sheet2!$A:$A)))

This does introduce another 2 functions (as it would with a named range),
which will slow things down, so it is debatable whether that is quicker than
putting in a large max row.

--

HTH

RP
(remove nothere from the email address if mailing direct)


"Max" wrote in message
...
=SUMPRODUCT(--(MONTH(Sheet2!A:A)=1),Sheet2!E:E),
this did not work


Entire col references aren't accepted in SUMPRODUCT

But you could use something like:

=SUMPRODUCT(--(MONTH(Sheet2!A1:A65535)=1),Sheet2!E1:E65535)

albeit this comes with quite a performance hit (slow calcs)

Maybe more viable if you were to reduce the "65535" in the formula to the
*smallest* max number of data rows expected in cols A and E in Sheet2, say
to 10000 or so ??

Another way to play it, if there's *no blank rows* in between the source
data, is to use dynamic ranges for cols A and E in Sheet2

Click Insert Name Define

Under Names in workbook, enter a name: Mth (say)

Put in the "Refers to" box :
=OFFSET(Sheet2!$A$1,,,COUNTA(Sheet2!$A:$A))

Click Add
(this creates a dynamic range for col A in Sheet2)

Repeat the steps above to make
another dynamic range for col E in Sheet2, viz.:

Clear and input for the name: Val (say)
Refers to:
=OFFSET(Sheet2!$E$1,,,COUNTA(Sheet2!$E:$E))

Now you can use this formula instead:
=SUMPRODUCT(--(MONTH(Mth)=1),Val)

--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"FBS" wrote in message
...
Right Bob it does work, Thanks
At first I wanted to select the whole column as a range as in this

sample
=SUMPRODUCT(--(MONTH(Sheet2!A:A)=1),Sheet2!E:E), this did not work, I

had
to
fix cell position as shown in your sample above.
I wanted the select the cell column because the Data that I am

refreshing
"from an external source" is set to change with every refresh. Looks I

will
have to fix this in another way so the data stays put in the same cell

of
the
excel worksheet.





  #8   Report Post  
Max
 
Posts: n/a
Default

"Bob Phillips" wrote
Although I would do it the way that Max suggested,
with a named range, ...


... um usually, I might just opt to take the performance hit and go it with
the direct 65535 route, with calc mode set to manual. Gives me a good excuse
to take a break each time calc is needed .. press F9, then off I go to enjoy
the break !! <bg Cheers.
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----


  #9   Report Post  
FBS
 
Posts: n/a
Default

You guys are awsome, Thank you very much
Cheers

"Max" wrote:

"Bob Phillips" wrote
Although I would do it the way that Max suggested,
with a named range, ...


... um usually, I might just opt to take the performance hit and go it with
the direct 65535 route, with calc mode set to manual. Gives me a good excuse
to take a break each time calc is needed .. press F9, then off I go to enjoy
the break !! <bg Cheers.
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----



  #10   Report Post  
Max
 
Posts: n/a
Default

You're welcome !
Thanks for the feedback ..
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"FBS" wrote in message
...
You guys are awsome, Thank you very much
Cheers





  #11   Report Post  
Bob Phillips
 
Posts: n/a
Default

and the coffee time :-)

"Max" wrote in message
...
You're welcome !
Thanks for the feedback ..
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----
"FBS" wrote in message
...
You guys are awsome, Thank you very much
Cheers





  #12   Report Post  
Max
 
Posts: n/a
Default

and the coffee time :-)
but of course <g
--
Rgds
Max
xl 97
---
GMT+8, 1° 22' N 103° 45' E
xdemechanik <atyahoo<dotcom
----


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
pivot help - limit data for last 20 dates Pivot Help Excel Worksheet Functions 0 February 28th 05 03:43 PM
Auto filling dates on other worksheets with data from a next payme JIM Excel Worksheet Functions 0 February 11th 05 04:59 PM
have dates entered from a list of data into an excel template Diane Excel Discussion (Misc queries) 1 December 28th 04 06:33 PM
How do I import fractions without data being converted to dates? rproeber Excel Discussion (Misc queries) 1 December 6th 04 12:53 AM
COUNTIF With Multiple Dates, Columns and Text Shannon Excel Worksheet Functions 4 November 26th 04 11:12 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"