ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Suming in multiple spreadsheets (https://www.excelbanter.com/excel-programming/377424-suming-multiple-spreadsheets.html)

Robert[_32_]

Suming in multiple spreadsheets
 
I have a Workbook with 6 spreadsheets. The first column in each spreadsheet
has the capitol letter 'D' in certain cells. I need to know how many times a
'D' appears in the first column of each spreadsheet. This total will be on
the last spreadsheet only.

I know this is elementary but I do not know much about VBA.
Many Thanks to anyone who will help!
--
Robert Hill


Bob Phillips

Suming in multiple spreadsheets
 
For Each sh In Activeworkbook.Worksheets
Msgbox sh.name & ", " & Application.Countif(sh.Range("A:A"),"D")
Next sh

--

HTH

Bob Phillips

(replace xxxx in the email address with gmail if mailing direct)

"Robert" wrote in message
...
I have a Workbook with 6 spreadsheets. The first column in each

spreadsheet
has the capitol letter 'D' in certain cells. I need to know how many

times a
'D' appears in the first column of each spreadsheet. This total will be

on
the last spreadsheet only.

I know this is elementary but I do not know much about VBA.
Many Thanks to anyone who will help!
--
Robert Hill




Tom Ogilvy

Suming in multiple spreadsheets
 
=countif(sheet1!A:A,"D")+countif(Sheet2!A:A,"D")+ and so forth

but countif is case insensitive. If there won't be any lowercase "d", then
perhaps this will work.

if not, you can use

=SUMPRODUCT(--EXACT(Sheet1!A1:A11,"D"))+SUMPRODUCT(--EXACT(Sheet2!A1:A11,"D"))+ and so forth

In this case, you can not refer to an entire column (and the fewer rows you
include, the faster it will recalculate).

--
Regards,
Tom Ogilvy






"Robert" wrote:

I have a Workbook with 6 spreadsheets. The first column in each spreadsheet
has the capitol letter 'D' in certain cells. I need to know how many times a
'D' appears in the first column of each spreadsheet. This total will be on
the last spreadsheet only.

I know this is elementary but I do not know much about VBA.
Many Thanks to anyone who will help!
--
Robert Hill


Robert[_32_]

Suming in multiple spreadsheets
 
Thanks...That is exactly what I needed.
--
Robert Hill



"Tom Ogilvy" wrote:

=countif(sheet1!A:A,"D")+countif(Sheet2!A:A,"D")+ and so forth

but countif is case insensitive. If there won't be any lowercase "d", then
perhaps this will work.

if not, you can use

=SUMPRODUCT(--EXACT(Sheet1!A1:A11,"D"))+SUMPRODUCT(--EXACT(Sheet2!A1:A11,"D"))+ and so forth

In this case, you can not refer to an entire column (and the fewer rows you
include, the faster it will recalculate).

--
Regards,
Tom Ogilvy






"Robert" wrote:

I have a Workbook with 6 spreadsheets. The first column in each spreadsheet
has the capitol letter 'D' in certain cells. I need to know how many times a
'D' appears in the first column of each spreadsheet. This total will be on
the last spreadsheet only.

I know this is elementary but I do not know much about VBA.
Many Thanks to anyone who will help!
--
Robert Hill



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

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