Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 70
Default sum worksheets with a certain criteria

I have created a worksheet for each individual person. I am trying to create
a formula that will filter though the different worksheets and sum the
people who have started on a specific date. Can somebody please tell me how
to do this or if it can even be done.

Thank you,

Tracy
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 132
Default sum worksheets with a certain criteria

Are your worksheets dynamic name and quantity (i.e. are the sheet names Bob,
Joe, Bill, etc. or sheet1, sheet2, sheet3 and do you frequently add and
remove sheets)? Is each individual's sheet similary structured (are you
looking at the same cell or range of cells on each sheet)?

Regards,
Bill


"Tracy" wrote:

I have created a worksheet for each individual person. I am trying to create
a formula that will filter though the different worksheets and sum the
people who have started on a specific date. Can somebody please tell me how
to do this or if it can even be done.

Thank you,

Tracy

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 70
Default sum worksheets with a certain criteria

The sheets are named Bob, Joe Bill etc. And yes, I do add and move sheets
frequently. All the sheets are copied and so they are the same structure. I
am looking for the same cell on each sheet. What I am trying to do is if a
person started on a particular date which is in cell A1 than add their
tuition which is in C1. I have done some reading on the THREED formula, but
when I use that I get a #REF! error. I really appreciate your help with
this. Thank you so much.

"Bill Pfister" wrote:

Are your worksheets dynamic name and quantity (i.e. are the sheet names Bob,
Joe, Bill, etc. or sheet1, sheet2, sheet3 and do you frequently add and
remove sheets)? Is each individual's sheet similary structured (are you
looking at the same cell or range of cells on each sheet)?

Regards,
Bill


"Tracy" wrote:

I have created a worksheet for each individual person. I am trying to create
a formula that will filter though the different worksheets and sum the
people who have started on a specific date. Can somebody please tell me how
to do this or if it can even be done.

Thank you,

Tracy

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 132
Default sum worksheets with a certain criteria

You can use this user-defined function to accomplish what you need.

This formula goes into a cell on your summary sheet:
=SumSalaries( "5/15/2005", "Sum1", "Sum3", "A1", "B1" )
Instead of literal values in quotation marks, you could also refer to cells
on your summary sheet that contain the corresponding values.
"5/15/2005" is the desired date.
Sum1 & Sum3 are the first and last of the individual sheets, respectively.
All other individual sheets must be between Sum1 & Sum3.
A1 is the address that contains the date on each individ. sheet. B1 is the
address to sum.

Put this code into a module in VBA:

Public Function SumSalaries(strCheckDate As String, strSheetStart As String,
strSheetEnd As String, strAddressCheck As String, strAddressSum As String) As
Double
Application.Volatile

Dim wkb As Workbook
Dim wks As Worksheet
Dim lngStart As Long
Dim lngEnd As Long
Dim i As Long
Dim dblTotal As Long

Set wkb = ThisWorkbook

If (Not (ExcelSheetExists(wkb, strSheetStart))) Then
Call MsgBox("Sheet (" & strSheetStart & ") does not exist!")
Exit Function
End If

If (Not (ExcelSheetExists(wkb, strSheetEnd))) Then
Call MsgBox("Sheet (" & strSheetEnd & ") does not exist!")
Exit Function
End If

lngStart = wkb.Worksheets(strSheetStart).Index
lngEnd = wkb.Worksheets(strSheetEnd).Index

strCheckDate = Format(strCheckDate, "mm/dd/yyyy")
dblTotal = 0

For i = lngStart To lngEnd
Set wks = wkb.Worksheets(i)
If (Format(wks.Range(strAddressCheck).Value, "mm/dd/yyyy") =
strCheckDate) Then
dblTotal = dblTotal + wks.Range(strAddressSum).Value
End If
Next i


SumSalaries = dblTotal

Set wkb = Nothing

End Function


Public Function ExcelSheetExists(wkb As Workbook, strSheet As String) As
Boolean
Dim wks As Worksheet

On Error GoTo ErrHandler

Set wks = wkb.Worksheets(strSheet)
ExcelSheetExists = True

Exit Function
ErrHandler:
ExcelSheetExists = False
End Function




"Tracy" wrote:

The sheets are named Bob, Joe Bill etc. And yes, I do add and move sheets
frequently. All the sheets are copied and so they are the same structure. I
am looking for the same cell on each sheet. What I am trying to do is if a
person started on a particular date which is in cell A1 than add their
tuition which is in C1. I have done some reading on the THREED formula, but
when I use that I get a #REF! error. I really appreciate your help with
this. Thank you so much.

"Bill Pfister" wrote:

Are your worksheets dynamic name and quantity (i.e. are the sheet names Bob,
Joe, Bill, etc. or sheet1, sheet2, sheet3 and do you frequently add and
remove sheets)? Is each individual's sheet similary structured (are you
looking at the same cell or range of cells on each sheet)?

Regards,
Bill


"Tracy" wrote:

I have created a worksheet for each individual person. I am trying to create
a formula that will filter though the different worksheets and sum the
people who have started on a specific date. Can somebody please tell me how
to do this or if it can even be done.

Thank you,

Tracy

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 70
Default sum worksheets with a certain criteria

Thank you for the information. I am afraid I have never done anything in
VBA. I have tried to figure out how to insert the code but have gotten side
tracked with other work. I hope to have more time tomorrw. I will take any
help you can offer though.

Thank you,

Tracy

"Bill Pfister" wrote:

You can use this user-defined function to accomplish what you need.

This formula goes into a cell on your summary sheet:
=SumSalaries( "5/15/2005", "Sum1", "Sum3", "A1", "B1" )
Instead of literal values in quotation marks, you could also refer to cells
on your summary sheet that contain the corresponding values.
"5/15/2005" is the desired date.
Sum1 & Sum3 are the first and last of the individual sheets, respectively.
All other individual sheets must be between Sum1 & Sum3.
A1 is the address that contains the date on each individ. sheet. B1 is the
address to sum.

Put this code into a module in VBA:

Public Function SumSalaries(strCheckDate As String, strSheetStart As String,
strSheetEnd As String, strAddressCheck As String, strAddressSum As String) As
Double
Application.Volatile

Dim wkb As Workbook
Dim wks As Worksheet
Dim lngStart As Long
Dim lngEnd As Long
Dim i As Long
Dim dblTotal As Long

Set wkb = ThisWorkbook

If (Not (ExcelSheetExists(wkb, strSheetStart))) Then
Call MsgBox("Sheet (" & strSheetStart & ") does not exist!")
Exit Function
End If

If (Not (ExcelSheetExists(wkb, strSheetEnd))) Then
Call MsgBox("Sheet (" & strSheetEnd & ") does not exist!")
Exit Function
End If

lngStart = wkb.Worksheets(strSheetStart).Index
lngEnd = wkb.Worksheets(strSheetEnd).Index

strCheckDate = Format(strCheckDate, "mm/dd/yyyy")
dblTotal = 0

For i = lngStart To lngEnd
Set wks = wkb.Worksheets(i)
If (Format(wks.Range(strAddressCheck).Value, "mm/dd/yyyy") =
strCheckDate) Then
dblTotal = dblTotal + wks.Range(strAddressSum).Value
End If
Next i


SumSalaries = dblTotal

Set wkb = Nothing

End Function


Public Function ExcelSheetExists(wkb As Workbook, strSheet As String) As
Boolean
Dim wks As Worksheet

On Error GoTo ErrHandler

Set wks = wkb.Worksheets(strSheet)
ExcelSheetExists = True

Exit Function
ErrHandler:
ExcelSheetExists = False
End Function




"Tracy" wrote:

The sheets are named Bob, Joe Bill etc. And yes, I do add and move sheets
frequently. All the sheets are copied and so they are the same structure. I
am looking for the same cell on each sheet. What I am trying to do is if a
person started on a particular date which is in cell A1 than add their
tuition which is in C1. I have done some reading on the THREED formula, but
when I use that I get a #REF! error. I really appreciate your help with
this. Thank you so much.

"Bill Pfister" wrote:

Are your worksheets dynamic name and quantity (i.e. are the sheet names Bob,
Joe, Bill, etc. or sheet1, sheet2, sheet3 and do you frequently add and
remove sheets)? Is each individual's sheet similary structured (are you
looking at the same cell or range of cells on each sheet)?

Regards,
Bill


"Tracy" wrote:

I have created a worksheet for each individual person. I am trying to create
a formula that will filter though the different worksheets and sum the
people who have started on a specific date. Can somebody please tell me how
to do this or if it can even be done.

Thank you,

Tracy



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 132
Default sum worksheets with a certain criteria


-Go to the Visual Basic Editor (Excel main menu / Tools / Macros / Visual
Basic Editor
-Press Ctrl-R to bring up the Project Explorer (it may already be up)
-Find your workbook and click on it in the Project Explorer
-Right-click and choose Insert / Module
-Copy-paste the "Put this code into a module in VBA" code into the window
-Close the editor
-Save your workbook



"Tracy" wrote:

Thank you for the information. I am afraid I have never done anything in
VBA. I have tried to figure out how to insert the code but have gotten side
tracked with other work. I hope to have more time tomorrw. I will take any
help you can offer though.

Thank you,

Tracy

"Bill Pfister" wrote:

You can use this user-defined function to accomplish what you need.

This formula goes into a cell on your summary sheet:
=SumSalaries( "5/15/2005", "Sum1", "Sum3", "A1", "B1" )
Instead of literal values in quotation marks, you could also refer to cells
on your summary sheet that contain the corresponding values.
"5/15/2005" is the desired date.
Sum1 & Sum3 are the first and last of the individual sheets, respectively.
All other individual sheets must be between Sum1 & Sum3.
A1 is the address that contains the date on each individ. sheet. B1 is the
address to sum.

Put this code into a module in VBA:

Public Function SumSalaries(strCheckDate As String, strSheetStart As String,
strSheetEnd As String, strAddressCheck As String, strAddressSum As String) As
Double
Application.Volatile

Dim wkb As Workbook
Dim wks As Worksheet
Dim lngStart As Long
Dim lngEnd As Long
Dim i As Long
Dim dblTotal As Long

Set wkb = ThisWorkbook

If (Not (ExcelSheetExists(wkb, strSheetStart))) Then
Call MsgBox("Sheet (" & strSheetStart & ") does not exist!")
Exit Function
End If

If (Not (ExcelSheetExists(wkb, strSheetEnd))) Then
Call MsgBox("Sheet (" & strSheetEnd & ") does not exist!")
Exit Function
End If

lngStart = wkb.Worksheets(strSheetStart).Index
lngEnd = wkb.Worksheets(strSheetEnd).Index

strCheckDate = Format(strCheckDate, "mm/dd/yyyy")
dblTotal = 0

For i = lngStart To lngEnd
Set wks = wkb.Worksheets(i)
If (Format(wks.Range(strAddressCheck).Value, "mm/dd/yyyy") =
strCheckDate) Then
dblTotal = dblTotal + wks.Range(strAddressSum).Value
End If
Next i


SumSalaries = dblTotal

Set wkb = Nothing

End Function


Public Function ExcelSheetExists(wkb As Workbook, strSheet As String) As
Boolean
Dim wks As Worksheet

On Error GoTo ErrHandler

Set wks = wkb.Worksheets(strSheet)
ExcelSheetExists = True

Exit Function
ErrHandler:
ExcelSheetExists = False
End Function




"Tracy" wrote:

The sheets are named Bob, Joe Bill etc. And yes, I do add and move sheets
frequently. All the sheets are copied and so they are the same structure. I
am looking for the same cell on each sheet. What I am trying to do is if a
person started on a particular date which is in cell A1 than add their
tuition which is in C1. I have done some reading on the THREED formula, but
when I use that I get a #REF! error. I really appreciate your help with
this. Thank you so much.

"Bill Pfister" wrote:

Are your worksheets dynamic name and quantity (i.e. are the sheet names Bob,
Joe, Bill, etc. or sheet1, sheet2, sheet3 and do you frequently add and
remove sheets)? Is each individual's sheet similary structured (are you
looking at the same cell or range of cells on each sheet)?

Regards,
Bill


"Tracy" wrote:

I have created a worksheet for each individual person. I am trying to create
a formula that will filter though the different worksheets and sum the
people who have started on a specific date. Can somebody please tell me how
to do this or if it can even be done.

Thank you,

Tracy

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
Command to count number of worksheets in a workbook? Saul Fowler Excel Worksheet Functions 3 February 6th 08 12:46 PM
Print order of worksheets Stray Doug Excel Discussion (Misc queries) 3 September 21st 05 12:37 AM
Duplicate Worksheets mlofton Excel Discussion (Misc queries) 1 September 7th 05 02:58 PM
Totalling Criteria from Muliple Worksheets Overworked&Underpaid Excel Discussion (Misc queries) 1 August 25th 05 08:14 PM
Changing a Link Mid-way Across Worksheets Frosty Excel Worksheet Functions 0 August 25th 05 12:03 AM


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

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"