Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default Conditional sort

Let say I have 2 Columns (A = Section, B=Class).
Section Class Value
Section1 A 1
Section2 B 1
Section3 A 1
Section2 D 1
Section1 B 1
Section2 A 1
Section1 B 1
Section1 E 1
Section1 A 1
Section2 A 1

The result I want is :
Column A,B, C - is sorted, but if Section and Class is the same, only
one will be displayed and the value is added in column C.
The result will be :

Section Class Value
Section1 A 2
Section1 B 2
Section1 E 1
Section2 A 2
Section2 B 1
Section2 D 1
Section3 A 1

Would apreciate your help.
Thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default Conditional sort

Have a look at pivot tables...that should do what you want.

OJ

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default Conditional sort

' assum,es tabel in C1-Enn

Option Explicit
Sub Sections()
Dim index
With Range(Range("C1"), Range("E1").End(xlDown))

.Sort Key1:=Range("C2"), Order1:=xlAscending, _
Key2:=Range("D2"), Order2:=xlAscending, _
Header:=xlGuess
For index = Range("E1").End(xlDown).Row To 3 Step -1
If Cells(index, "C") = Cells(index - 1, "C") Then
If Cells(index, "D") = Cells(index - 1, "D") Then
Cells(index - 1, "E") = Cells(index - 1, "E") +
Cells(index, "E")
Rows(index).Delete
End If
End If
Next

End With

End Sub

"broogle" wrote:

Let say I have 2 Columns (A = Section, B=Class).
Section Class Value
Section1 A 1
Section2 B 1
Section3 A 1
Section2 D 1
Section1 B 1
Section2 A 1
Section1 B 1
Section1 E 1
Section1 A 1
Section2 A 1

The result I want is :
Column A,B, C - is sorted, but if Section and Class is the same, only
one will be displayed and the value is added in column C.
The result will be :

Section Class Value
Section1 A 2
Section1 B 2
Section1 E 1
Section2 A 2
Section2 B 1
Section2 D 1
Section3 A 1

Would apreciate your help.
Thanks


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
Conditional formatting - sort of kafter244 Excel Worksheet Functions 4 January 18th 09 07:48 AM
Some sort of conditional sum? Andrew Mackenzie Excel Discussion (Misc queries) 3 January 14th 09 05:57 PM
Sort of like SUMIF and COUNTIF - but return a conditional value hr38581 Excel Discussion (Misc queries) 2 May 3rd 08 04:28 PM
Conditional Sort? Eric Excel Discussion (Misc queries) 9 July 22nd 07 12:42 PM
Sort by conditional formats? jbtenor1 Excel Worksheet Functions 6 January 5th 06 06:12 PM


All times are GMT +1. The time now is 06:31 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"