Compare score and get the heights related data in row D. Else in E.
Compare score and get the heights related data in row D. Else in E.
You need to explain your results. I can't see any logic for this.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
find the top score in each cell and copy data in D. Others will go in E.
In 2nd row i.e, in B2 "3.333" is the top score in group so top score related data i.e, D will go in D2 cell. All other data will go to E2.
Please add location to your VBAX profile.
Sub Test() For Each cel In Range("B2:B4") 'Adjust to suit Mx = 0: op1 = "": op2 = "" x = Split(cel, Chr(10)) y = Split(cel.Offset(, 1), Chr(10)) For i = 0 To UBound(x) If CDbl(x(i)) > Mx Then Mx = CDbl(x(i)) Next For i = 0 To UBound(x) If CDbl(x(i)) = Mx Then op1 = op1 & y(i) & "," Else op2 = op2 & y(i) & "," End If Next cel.Offset(, 2) = Left(op1, Len(op1) - 1) cel.Offset(, 3) = Left(op2, Len(op2) - 1) Next End Sub
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
Thanks a lot....And if I do not know the range ?
There are many ways to define a range depending upon your layout/requirements including Selection, finding LastRow, UsedRange, CurrentRegion, SpecialCells, Dynamic Range Names. You'll see a lot of examples in code here or search Google to find the most appropriate.
MVP (Excel 2008-2010)
Post a workbook with sample data and layout if you want a quicker solution.
To help indent your macros try Smart Indent
Please remember to mark threads 'Solved'
According to the original poster, the range is in Column "B"
I expect the student to do their homework and find all the errrors I leeve in.
Please take the time to read the Forum FAQ