ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   sumproduct with COUNTIF With An INDIRECT (https://www.excelbanter.com/excel-discussion-misc-queries/448754-sumproduct-countif-indirect.html)

angie.chang

sumproduct with COUNTIF With An INDIRECT
 
1 Attachment(s)
I have multiple worksheets within the workbook. There are tab 1,2, 3, etc. Each tab represent days of month(May).

I have a rep stats summary tab to sum up by rep. I would like to know if there is a easier way to create this formula? A rep may be listed more than one time in a day or per tab.


Attached is a copy of the excel. I am trying to see if there is a faster to sum up all worksheets and count rep in the summary tab.

Thanks,

GS[_2_]

sumproduct with COUNTIF With An INDIRECT
 
Try this UDF! It needs to be stored in a standard module to be used as
a worksheet formula. To do this...

keyboard Alt+F11 to open the VBE
select InsertModule on the menubar

...then paste the following into the empty window.

Option Explicit

Function Get_RepStats&(Rep As Range)
Application.Volatile
Dim wks
Const sRng$ = "$C$2:$C$61" '//edit to suit
For Each wks In ActiveWorkbook.Worksheets
If Not wks.Name = "Rep Stats" Then
Get_RepStats = Get_RepStats _
+ WorksheetFunction.CountIf(wks.Range(sRng), Rep)
End If
Next 'wks
End Function

To use it, select C3:C150 on "Rep Stats" and type the following
formula...

=get_repstats($B3)

...then hold down the 'Ctrl' key and press 'Enter'.

--
Garry

Free usenet access at http://www.eternal-september.org
Classic VB Users Regroup!
comp.lang.basic.visual.misc
microsoft.public.vb.general.discussion




All times are GMT +1. The time now is 10:23 AM.

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