Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
G G is offline
external usenet poster
 
Posts: 52
Default Hide AND Exclude?

Is there a feature in Excel that will allow me to EXCLUDE a row from a
calculation? I'm trying to keep the row (don't want to delete it), but
exclude it from calculations.
Here's an example:

A B

1 "Y" 5
2 "Y" 4
3 "N" 5
4 "Y" 3


When I use the following, it HIDES row 3:

Dim cell As Range
For Each cell In Worksheets("worksheet").Range("A1:A4")
If cell.Text < "Y" Then
cell.EntireRow.Hidden = True
End If

However, when I use the following to SORT, it still considers the hidden cell:

Selection.Sort Key1:=Range("A1:A4"), Order1:=xlAscending, Key2:=Range("A1"),
Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom

I want to EXCLUDE cell A3 because it isn't an "Y". Here's what I want to
show:

A

1 3
2 5
3 5

Any ideas?

Thanks.

Gary

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Hide AND Exclude?

Use a sumif or similar type of function. What operation are you trying to
perform?


"G" wrote:

Is there a feature in Excel that will allow me to EXCLUDE a row from a
calculation? I'm trying to keep the row (don't want to delete it), but
exclude it from calculations.
Here's an example:

A B

1 "Y" 5
2 "Y" 4
3 "N" 5
4 "Y" 3


When I use the following, it HIDES row 3:

Dim cell As Range
For Each cell In Worksheets("worksheet").Range("A1:A4")
If cell.Text < "Y" Then
cell.EntireRow.Hidden = True
End If

However, when I use the following to SORT, it still considers the hidden cell:

Selection.Sort Key1:=Range("A1:A4"), Order1:=xlAscending, Key2:=Range("A1"),
Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom

I want to EXCLUDE cell A3 because it isn't an "Y". Here's what I want to
show:

A

1 3
2 5
3 5

Any ideas?

Thanks.

Gary

  #3   Report Post  
Posted to microsoft.public.excel.programming
G G is offline
external usenet poster
 
Posts: 52
Default Hide AND Exclude?

My question (below) sounds confusing, but I'm basically looking to take a
range and sort it, but EXCLUDE cells in a range from the SORT if it doesn't
fit a certain critiera. Something like the HIDE function for an entire row,
but HIDE doesn't exclude the cell from the SORT, it only hides it.

"Cody" wrote:

Use a sumif or similar type of function. What operation are you trying to
perform?


"G" wrote:

Is there a feature in Excel that will allow me to EXCLUDE a row from a
calculation? I'm trying to keep the row (don't want to delete it), but
exclude it from calculations.
Here's an example:

A B

1 "Y" 5
2 "Y" 4
3 "N" 5
4 "Y" 3


When I use the following, it HIDES row 3:

Dim cell As Range
For Each cell In Worksheets("worksheet").Range("A1:A4")
If cell.Text < "Y" Then
cell.EntireRow.Hidden = True
End If

However, when I use the following to SORT, it still considers the hidden cell:

Selection.Sort Key1:=Range("A1:A4"), Order1:=xlAscending, Key2:=Range("A1"),
Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom

I want to EXCLUDE cell A3 because it isn't an "Y". Here's what I want to
show:

A

1 3
2 5
3 5

Any ideas?

Thanks.

Gary

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 71
Default Hide AND Exclude?

I don't see how to make that work. You are basically trying to sort multiple
ranges by breaking the range at the excluded row. You can sort the excluded
rows to the end of the selection by sorting the "Y"s and "N"s first and then
performing your operation on a contiguous range.

"G" wrote:

My question (below) sounds confusing, but I'm basically looking to take a
range and sort it, but EXCLUDE cells in a range from the SORT if it doesn't
fit a certain critiera. Something like the HIDE function for an entire row,
but HIDE doesn't exclude the cell from the SORT, it only hides it.

"Cody" wrote:

Use a sumif or similar type of function. What operation are you trying to
perform?


"G" wrote:

Is there a feature in Excel that will allow me to EXCLUDE a row from a
calculation? I'm trying to keep the row (don't want to delete it), but
exclude it from calculations.
Here's an example:

A B

1 "Y" 5
2 "Y" 4
3 "N" 5
4 "Y" 3


When I use the following, it HIDES row 3:

Dim cell As Range
For Each cell In Worksheets("worksheet").Range("A1:A4")
If cell.Text < "Y" Then
cell.EntireRow.Hidden = True
End If

However, when I use the following to SORT, it still considers the hidden cell:

Selection.Sort Key1:=Range("A1:A4"), Order1:=xlAscending, Key2:=Range("A1"),
Order2:=xlAscending, Header:=xlGuess, OrderCustom:=1, MatchCase:=False,
Orientation:=xlTopToBottom

I want to EXCLUDE cell A3 because it isn't an "Y". Here's what I want to
show:

A

1 3
2 5
3 5

Any ideas?

Thanks.

Gary

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
Want to Hide columns in spreadsheet but NOT hide data in chart. KrispyData Charts and Charting in Excel 1 March 20th 09 04:45 PM
A1 = 200:1, B1 is 200 / 1 (200 from A1 - How to exclude :1?) wcooke Excel Worksheet Functions 1 March 5th 08 04:20 PM
Exclude a row from a SUM Andrew Dyson Excel Discussion (Misc queries) 3 January 22nd 07 02:38 PM
Exclude Michell Major Excel Discussion (Misc queries) 2 October 18th 06 11:52 AM
How do I hide a worksheet in Excel and use a password to un-hide . Dchung Excel Discussion (Misc queries) 3 December 2nd 04 06:24 AM


All times are GMT +1. The time now is 07:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"