LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 527
Default Columns into 2 way tables

Hi

You have probably deleted this reference by now but for interest I finally
created a solution using a formula and macro. The formula was in response to
TVAlco's post regarding duplicate values in Sales. I know it is highly
improbably, but still.

To find the Nominal Rank, nominal because it depends on who occurs first in
the list, add this formula:=
=SUMPRODUCT(--(risk=A2),--(Sales=C2))-COUNTIF($C$2:C2,C2)+1

The macro uses this formula to decide where to place the Name.

Sub RiskByRank()
Dim i As Integer, lr As Integer, r As Integer, j As Integer
Dim c, risk, rnk As Integer, col As Integer
Dim rng As Range
risk = Array("Low", "Mid", "High")
'clear old data
Range("F1").CurrentRegion.ClearContents
lr = Range("a1").CurrentRegion.Rows.Count
Range("F1:H1") = risk
Set rng = Range(Cells(2, 1), Cells(lr, 1))
col = 6
For i = LBound(risk) To UBound(risk)
r = 1
For Each c In rng
rnk = c.Offset(0, 3)
If c = risk(i) Then
Cells(r + rnk, col) = c.Offset(0, 1)
End If
Next c
col = col + 1
Next i

End Sub

Regards
Peter Atherton


"Christian" wrote:

Hi Dave,
it worked!!
I had included the first row in the ranges.
Many thanks,
Enjoy a virtual belgian beer on my behalf
regards Christian

"Dave" wrote:

Hi Christian,
I tried TM's formula, and it works for me.

You have to name ranges:
A2:A10 = Risk
B2:B10 = Name
C2:C10 = Sales

Then enter:
Low into E1
Mid into F1
High into G1

Then TM's formula in E2
Fill across, then down.

Any luck?
Dave.

 
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
pivot tables - add columns Renata Excel Worksheet Functions 1 May 20th 08 02:17 AM
Inserted Columns into VLOOKUP Tables RJB[_2_] Excel Discussion (Misc queries) 4 April 9th 08 02:49 PM
Formatting Columns in Pivot Tables dmasch Excel Discussion (Misc queries) 5 February 25th 07 05:41 PM
Pivot Tables - # of Columns David Excel Discussion (Misc queries) 1 March 17th 06 03:38 AM
Pivot tables - inserting columns Scott Excel Worksheet Functions 1 March 19th 05 01:07 AM


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