![]() |
|
|
|
#1
|
|||
|
|||
|
Hallo!
Is it possible to select data greater than "14" in the column J for creating a graph? The column J has data that can vary from 0 to 30 but I would like to consider only data greater than 14, and the corresponding value in the column M Hope I was clear... Thanks!
|
|
#2
|
|||
|
|||
|
the following will graph data in column J.
I don't understand what you mean by : Quote:
Code:
Option Explicit
Sub y()
Application.ScreenUpdating = False
Worksheets("Sheet1").Range("J2").AutoFilter _
Field:=1, _
Criteria1:=">" & "14" ', _
Dim Sorce, Targt As Worksheet
Set Sorce = ThisWorkbook.Sheets("Sheet1")
Set Targt = ThisWorkbook.Sheets("Sheet2")
Sorce.Range("J2:J100").SpecialCells(xlCellTypeVisible).Copy
Targt.Cells(1, 1).PasteSpecial
Sheets("Sheet2").Activate
Sheets("Sheet2").Range("A1").Select
Macro1
Range("A1").Select
Application.CutCopyMode = False
Application.Wait Now + #12:00:02 AM#
Sheets("Sheet1").Activate
Range("A1").Select
On Error Resume Next
'If ActiveSheet.FilterMode Then ActiveSheet.ShowAllData
'If ActiveSheet.AutoFilterMode Then ActiveSheet.ShowAllData
Cells.AutoFilter
Application.ScreenUpdating = True
End Sub
Sub Macro1()
'
' Macro1 Macro
'
'
ActiveSheet.Shapes.AddChart.Select
Dim rng As Range
Dim cht As Object
Dim LastRow As Long
LastRow = Cells(Rows.Count, "A").End(xlUp).Row
Set rng = ActiveSheet.Range("A1:A" & LastRow)
'rng.Select
ActiveChart.SetSourceData Source:=rng
ActiveChart.ChartType = xlColumnClustered
End Sub
|
|
#3
|
||||
|
||||
|
Another 2 ways in the attached:
On Sheet1, an Autofilter has been applied to column J to keep only rows where the value is greater than 14 On Sheet2, the number 14 has been entered in cell L1. This number is used in the formulae in the cells in column K, to show the number in column J if it's greater than the value in cell L1 or #N/A if it's not. It's this column K which is plotted. |
|
#4
|
|||
|
|||
|
Thanks to all, I appreciate so much!
solution on sheet2 seems to be more easy for me to work with. ![]() Attached the table with some more data, could you pls check it ? Thanks! |
|
#5
|
||||
|
||||
|
See attached Sheet2. Also Sheet1 tweaked using the other method.
|
|
#6
|
|||
|
|||
|
Thank you Logit, but for my purposes it is easier the solution Sheet 2 from p45cal.
![]() Could the graph in sheet 2 be done with a line instaed of ponts? ![]() Thank you !
|
|
#7
|
||||
|
||||
|
Quote:
or: 2024-10-14_211223.jpg |
|
#8
|
|||
|
|||
|
Based on your last posted workbook (Post #4) the following functions as desired here :
Code:
Option Explicit
Sub FiltrCols()
Dim lrow As Long
Dim piece
Worksheets("Sheet2").Range("L2").AutoFilter _
Field:=2, _
Criteria1:=">" & "14"
Application.ScreenUpdating = False
Dim Sorce, Targt As Worksheet
Sheets("Sheet3").UsedRange.Delete
'##delete old chart (if exists) from sheet
If Sheets("Sheet3").ChartObjects.Count > 0 Then
Sheets("Sheet3").ChartObjects(1).Delete
End If
lrow = Range("L16").End(xlUp).Row
For Each piece In Array("L2:L16", "M2:M16")
Range(piece).Copy
With Sheet3.Range(piece).Offset(0, -11)
.PasteSpecial
.PasteSpecial xlPasteValues
End With
Next
Sheet3.Rows(1).EntireRow.Delete
Create_Chart_Variable_Rows_NEW
Application.CutCopyMode = False
Sheets("Sheet3").Activate
Sheets("Sheet3").Range("A1").Select
Range("A1").Select
Application.CutCopyMode = False
Sheets("Sheet2").Activate
Range("A1").Select
On Error Resume Next
Cells.AutoFilter
Application.ScreenUpdating = True
MsgBox "Done !"
End Sub
Sub Create_Chart_Variable_Rows_NEW()
'
On Error Resume Next
Dim ws As Worksheet
Set ws = Sheets("Sheet3")
Dim rng As Range
Dim objChrt As ChartObject
Dim chrt As Chart
'
Dim r As Long
r = ws.Cells(Rows.Count, "A").End(xlUp).Row
'
With ws
Set rng = .Range("A1:A" & r & ",B1:B" & r)
.Shapes.AddChart
Set objChrt = .ChartObjects(.ChartObjects.Count)
Set chrt = objChrt.Chart
With chrt
.ChartType = xlColumnClustered
.SetSourceData Source:=rng
End With
End With
End Sub
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| How to create a report with a graph showing data from diferent updates/status data | MikelZU | Project | 1 | 04-30-2021 12:19 AM |
| Formula to deduct a figure the sum of two cells is equal to or greater than a certain valu | AlanBird | Excel | 3 | 11-25-2017 03:11 PM |
Auto update excel graph range, ignore data when date reads 00-Month-00
|
SavGDK | Excel | 2 | 06-24-2016 08:05 AM |
| Need help with excel formula greater than.. | bm868 | Excel | 2 | 01-02-2016 10:29 AM |
| How to create a column graph from row data in excel | jyfuller | Excel | 0 | 07-02-2013 05:07 AM |