Suming in multiple spreadsheets

G

Guest

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!
 
B

Bob Phillips

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)
 
G

Guest

=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).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top