ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Steam Leaf Plot in Excel (https://www.excelbanter.com/excel-programming/332262-steam-leaf-plot-excel.html)

Ben

Steam Leaf Plot in Excel
 
Did anybody know, how to create a steam leaf plot with Excel?

Thanks,
Tilo

K Dales[_2_]

Steam Leaf Plot in Excel
 
To my knowledge there is no built-in ability in Excel to do a stem-leaf plot.

"Ben" wrote:

Did anybody know, how to create a steam leaf plot with Excel?

Thanks,
Tilo


Mike Middleton[_4_]

Steam Leaf Plot in Excel
 
Ben or Tilo -

Did anybody know, how to create a steam leaf plot with Excel? <


What happens if you go to www.google.com, click on Groups, type "stem leaf
plot with Excel" (without the quotes), and click Search Groups?

You'll get fewer results if you search for "steam leaf plot with Excel."

- Mike
www.mikemiddleton.com



Toppers

Steam Leaf Plot in Excel
 
Ben,
Try this as a starter:

Sub StemAndLeafPlot()

Dim inRng As Range, cell As Range
Dim ws1 As Worksheet, ws2 As Worksheet
Dim MaxVal As Integer, MinVal As Integer, lIndex As Integer, uIndex As Integer
Dim i As Integer, n As Integer, j As Integer

Set ws1 = Worksheets("sheet1")
With ws1
Set inRng = .Range("a1:a" & .Cells(Rows.Count, "A").End(xlUp).Row)
End With

MaxVal = Application.Max(inRng)
MinVal = Application.Min(inRng)

lIndex = Int(MinVal / 10) * 10
uIndex = (Int(MaxVal / 10)) * 10

Set ws2 = Worksheets("sheet2")
ws2.Cells.ClearContents

i = 0
For n = lIndex To uIndex Step 10 ' Write Stems
i = i + 1
ws2.Cells(i, 1) = n
Next n

For Each cell In inRng ' Write Leaves
i = Int((cell.Value - lIndex) / 10) + 1
n = cell.Value Mod 10
j = Application.CountA(ws2.Rows(i)) + 1
ws2.Cells(i, j) = n
Next cell

End Sub

HTH

"Ben" wrote:

Did anybody know, how to create a steam leaf plot with Excel?

Thanks,
Tilo



All times are GMT +1. The time now is 10:56 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com