Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default sum non contig cells based on hidden rows

Hi everyone,

I'm not sure that the subject line explains anything but what I would like
to do is to be able to sum a range of non-contiguous cells BUT if rows are
hidden not to sum the values in those cells.

I need to calculate scores from employees - supervisors may have 1 to 5
people reporting to them and I want to send out a generic workbook so I have
a macrobuttons on sheet 1 for them to select number of employees and this
hides the appropriate number of rows. Supervisors can then enter scores for
just those employees and most importantly calculates the score

The range is in Column H starting at Row 9 and then every other row to row
17 and cells are formatted as numbers.

There are other scores on this page not relating to individual employees and
these also have to add to the total.

At the moment the scores are summed in C45 and Averaged in D45 but I'm
guessing that the calculation will need to be done from a calculate
macrobutton.

If annyone could help that would be brilliant :-)

Thank you

--
Trish
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,355
Default sum non contig cells based on hidden rows

If you had a column that included the supervisors name, you could probably
get the result with SUMPRODUCT. Come back if you have any questions. Give
specifics of the cells with the Supervisors names, and Scores that are to be
summed.
--
HTH,
Barb Reinhardt



"Trish Smith" wrote:

Hi everyone,

I'm not sure that the subject line explains anything but what I would like
to do is to be able to sum a range of non-contiguous cells BUT if rows are
hidden not to sum the values in those cells.

I need to calculate scores from employees - supervisors may have 1 to 5
people reporting to them and I want to send out a generic workbook so I have
a macrobuttons on sheet 1 for them to select number of employees and this
hides the appropriate number of rows. Supervisors can then enter scores for
just those employees and most importantly calculates the score

The range is in Column H starting at Row 9 and then every other row to row
17 and cells are formatted as numbers.

There are other scores on this page not relating to individual employees and
these also have to add to the total.

At the moment the scores are summed in C45 and Averaged in D45 but I'm
guessing that the calculation will need to be done from a calculate
macrobutton.

If annyone could help that would be brilliant :-)

Thank you

--
Trish

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default sum non contig cells based on hidden rows

On Aug 27, 2:16*pm, Trish Smith
wrote:
Hi everyone,

I'm not sure that the subject line explains anything but what I would like
to do is to be able to sum a range of non-contiguous cells BUT if rows are
hidden not to sum the values in those cells.

I need to calculate scores from employees - supervisors may have 1 to 5
people reporting to them and I want to send out a generic workbook so I have
a macrobuttons on sheet 1 for them to select number of employees and this
hides the appropriate number of rows. Supervisors can then enter scores for
just those employees and most importantly calculates the score

The range is in Column H starting at Row 9 and then every other row to row
17 and cells are formatted as numbers.

There are other scores on this page not relating to individual employees and
these also have to add to the total.

At the moment the scores are summed in C45 and Averaged in D45 but I'm
guessing that the calculation will need to be done from a calculate
macrobutton.

If annyone could help that would be brilliant :-)

Thank you

--
Trish


Have you tried using the SUBTOTAL function? Using
=SUBTOTAL(109,A1:A10) should ignore any hidden values when calculating
the total in the range. Check out the help file for other
examples ...

Rob
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default sum non contig cells based on hidden rows

Hi Barb,

Thanks for answering,

I don't have those details - I've been asked to do this for another
department as a favour and what seemed like a relatively easy job has become
complicated - C'est la vie!

It also needs to be generic because it's going out to 30+ small teams and
when it needs changing I don't want to have to change lots of versions. Ok so
it would only be 5 with the different number of employees but my boss has
already lost his patience with this.

I know it's cheeky but I'd still like to see if there is a VBA solution :-)

Many thanks
--
Trish


"Barb Reinhardt" wrote:

If you had a column that included the supervisors name, you could probably
get the result with SUMPRODUCT. Come back if you have any questions. Give
specifics of the cells with the Supervisors names, and Scores that are to be
summed.
--
HTH,
Barb Reinhardt



"Trish Smith" wrote:

Hi everyone,

I'm not sure that the subject line explains anything but what I would like
to do is to be able to sum a range of non-contiguous cells BUT if rows are
hidden not to sum the values in those cells.

I need to calculate scores from employees - supervisors may have 1 to 5
people reporting to them and I want to send out a generic workbook so I have
a macrobuttons on sheet 1 for them to select number of employees and this
hides the appropriate number of rows. Supervisors can then enter scores for
just those employees and most importantly calculates the score

The range is in Column H starting at Row 9 and then every other row to row
17 and cells are formatted as numbers.

There are other scores on this page not relating to individual employees and
these also have to add to the total.

At the moment the scores are summed in C45 and Averaged in D45 but I'm
guessing that the calculation will need to be done from a calculate
macrobutton.

If annyone could help that would be brilliant :-)

Thank you

--
Trish

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,814
Default sum non contig cells based on hidden rows

Hi Trish,
Try this function: it will count all cells in the range you select except
for the ones that are hidden:

Function SumH(sRange)
Dim iIdx As Integer
Dim iCount As Long

iCount = 0
For iIdx = 1 To sRange.Cells.Count
If Rows(sRange.Cells(iIdx).Row).Hidden = False Then
iCount = iCount + sRange.Cells(iIdx).Value
End If
Next
SumH = iCount
End Function

"Trish Smith" wrote:

Hi everyone,

I'm not sure that the subject line explains anything but what I would like
to do is to be able to sum a range of non-contiguous cells BUT if rows are
hidden not to sum the values in those cells.

I need to calculate scores from employees - supervisors may have 1 to 5
people reporting to them and I want to send out a generic workbook so I have
a macrobuttons on sheet 1 for them to select number of employees and this
hides the appropriate number of rows. Supervisors can then enter scores for
just those employees and most importantly calculates the score

The range is in Column H starting at Row 9 and then every other row to row
17 and cells are formatted as numbers.

There are other scores on this page not relating to individual employees and
these also have to add to the total.

At the moment the scores are summed in C45 and Averaged in D45 but I'm
guessing that the calculation will need to be done from a calculate
macrobutton.

If annyone could help that would be brilliant :-)

Thank you

--
Trish



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default sum non contig cells based on hidden rows

Thanks Steve :-)
--
Trish


"Steve" wrote:

Hi Trish,
Try this function: it will count all cells in the range you select except
for the ones that are hidden:

Function SumH(sRange)
Dim iIdx As Integer
Dim iCount As Long

iCount = 0
For iIdx = 1 To sRange.Cells.Count
If Rows(sRange.Cells(iIdx).Row).Hidden = False Then
iCount = iCount + sRange.Cells(iIdx).Value
End If
Next
SumH = iCount
End Function

"Trish Smith" wrote:

Hi everyone,

I'm not sure that the subject line explains anything but what I would like
to do is to be able to sum a range of non-contiguous cells BUT if rows are
hidden not to sum the values in those cells.

I need to calculate scores from employees - supervisors may have 1 to 5
people reporting to them and I want to send out a generic workbook so I have
a macrobuttons on sheet 1 for them to select number of employees and this
hides the appropriate number of rows. Supervisors can then enter scores for
just those employees and most importantly calculates the score

The range is in Column H starting at Row 9 and then every other row to row
17 and cells are formatted as numbers.

There are other scores on this page not relating to individual employees and
these also have to add to the total.

At the moment the scores are summed in C45 and Averaged in D45 but I'm
guessing that the calculation will need to be done from a calculate
macrobutton.

If annyone could help that would be brilliant :-)

Thank you

--
Trish

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default sum non contig cells based on hidden rows

Hi Barb,

I've has a rethink and doing it differently.

Thanks for your help :-)
--
Trish


"Trish Smith" wrote:

Hi Barb,

Thanks for answering,

I don't have those details - I've been asked to do this for another
department as a favour and what seemed like a relatively easy job has become
complicated - C'est la vie!

It also needs to be generic because it's going out to 30+ small teams and
when it needs changing I don't want to have to change lots of versions. Ok so
it would only be 5 with the different number of employees but my boss has
already lost his patience with this.

I know it's cheeky but I'd still like to see if there is a VBA solution :-)

Many thanks
--
Trish


"Barb Reinhardt" wrote:

If you had a column that included the supervisors name, you could probably
get the result with SUMPRODUCT. Come back if you have any questions. Give
specifics of the cells with the Supervisors names, and Scores that are to be
summed.
--
HTH,
Barb Reinhardt



"Trish Smith" wrote:

Hi everyone,

I'm not sure that the subject line explains anything but what I would like
to do is to be able to sum a range of non-contiguous cells BUT if rows are
hidden not to sum the values in those cells.

I need to calculate scores from employees - supervisors may have 1 to 5
people reporting to them and I want to send out a generic workbook so I have
a macrobuttons on sheet 1 for them to select number of employees and this
hides the appropriate number of rows. Supervisors can then enter scores for
just those employees and most importantly calculates the score

The range is in Column H starting at Row 9 and then every other row to row
17 and cells are formatted as numbers.

There are other scores on this page not relating to individual employees and
these also have to add to the total.

At the moment the scores are summed in C45 and Averaged in D45 but I'm
guessing that the calculation will need to be done from a calculate
macrobutton.

If annyone could help that would be brilliant :-)

Thank you

--
Trish

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 49
Default sum non contig cells based on hidden rows

Thanks Rob
--
Trish


"Rob Allchurch" wrote:

On Aug 27, 2:16 pm, Trish Smith
wrote:
Hi everyone,

I'm not sure that the subject line explains anything but what I would like
to do is to be able to sum a range of non-contiguous cells BUT if rows are
hidden not to sum the values in those cells.

I need to calculate scores from employees - supervisors may have 1 to 5
people reporting to them and I want to send out a generic workbook so I have
a macrobuttons on sheet 1 for them to select number of employees and this
hides the appropriate number of rows. Supervisors can then enter scores for
just those employees and most importantly calculates the score

The range is in Column H starting at Row 9 and then every other row to row
17 and cells are formatted as numbers.

There are other scores on this page not relating to individual employees and
these also have to add to the total.

At the moment the scores are summed in C45 and Averaged in D45 but I'm
guessing that the calculation will need to be done from a calculate
macrobutton.

If annyone could help that would be brilliant :-)

Thank you

--
Trish


Have you tried using the SUBTOTAL function? Using
=SUBTOTAL(109,A1:A10) should ignore any hidden values when calculating
the total in the range. Check out the help file for other
examples ...

Rob

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
Hidden rows/columns expand when referencing cells? tink Excel Worksheet Functions 1 October 9th 08 08:48 PM
Rows hidden by Autofilter vs hidden by changing the Hidden property LEO@KCC Excel Programming 4 September 11th 07 10:14 AM
Determine Cells(5,4) IN SPITE of hidden rows/columns Finny[_3_] Excel Programming 7 March 1st 07 04:01 PM
Macro that will hidden columns, rows and worksheets based on an identifier [email protected] Excel Discussion (Misc queries) 2 November 27th 06 03:49 PM
Using VB to unhide hidden rows based on user response Lost[_2_] Excel Programming 2 August 22nd 03 01:27 AM


All times are GMT +1. The time now is 01:13 PM.

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"