ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Sum data in workbook 1 and write result in workbook 2 (https://www.excelbanter.com/excel-programming/360781-sum-data-workbook-1-write-result-workbook-2-a.html)

Martin[_28_]

Sum data in workbook 1 and write result in workbook 2
 
Hi,

I need some help with excel macro!
I have two workbooks. Now I need to sum all cells with some date criteria
from first workook
and result must be inserted in cell in second workbook (for example in cell
A1)

WorkBook1 data example

Column B (dates) Column C (payroll)
12.05.2005 1200
12.05.2005 5000
14.05.2005 3100
14.05.2005 8800
17.05.2005 3550
....


For example: sum all values in column C where date in column B is 12.05.2005
and put result in workbook 2 in cell A1

Thanks for help.



Nick Hodge

Sum data in workbook 1 and write result in workbook 2
 
Martin

You don't need a macro, just a formula. If the data is in book1.xls and you
want the answer in book2.xls, the formula would be something like.

=SUMIF([Book1]Sheet1!$A$1:$A$11,[Book1]Sheet1!$A$1,[Book1]Sheet1!$B$1:$B$11)

To work this, enter the =SUMIF(

in book2 and then select the dates in book1, type a comma and then select
the date you are using as the criteria or type it in "". then enter a comma
and select the data you are wanting to sum

--
HTH
Nick Hodge
Microsoft MVP - Excel
Southampton, England
www.nickhodge.co.uk
HIS


"Martin" wrote in message
...
Hi,

I need some help with excel macro!
I have two workbooks. Now I need to sum all cells with some date criteria
from first workook
and result must be inserted in cell in second workbook (for example in
cell A1)

WorkBook1 data example

Column B (dates) Column C (payroll)
12.05.2005 1200
12.05.2005 5000
14.05.2005 3100
14.05.2005 8800
17.05.2005 3550
...


For example: sum all values in column C where date in column B is
12.05.2005 and put result in workbook 2 in cell A1

Thanks for help.





All times are GMT +1. The time now is 09:23 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com