Plotting and selecting data

M

Matt S

Hello, I have a long-winded question:

I am analyzing data that goes in a sequence. I have:
Segments 1-15 as the first part of my test
Segments 16-18 as the second part of my test.

My macro calculates the time elapsed from segments 1-15 in column AO and
16-18 in column AQ. If the time period is not running, then I have it
specified to pump out "" as the output. What I'd like to do is plot my
y-axis data in column AI in two graphs: AI versus AO and then another AI
versus AQ. I do not know how to make the macro realize when the timer has
started in the segment and when it has ended so that I can plot my graphs, as
the starting row is never the same between files.

Any help would be appreciated!
Thanks!
<3 Matt
 
M

Matt S

No, essentially what I have is the following:

data time1
data time1
data time1
data time2
data time2
data time2

What I'd like to do is to start/end the series when time begins/ends.

Matt
 
J

Jon Peltier

If you change "" to NA() in the formula, you will get something that looks
like this:

data time1 #N/A
data time1 #N/A
data time1 #N/A
data #N/A time2
data #N/A time2
data #N/A time2

The #N/A errors look ugly, but they are omitted in a line or XY chart
(rather than plotting as a zero).

- Jon
 
M

Matt S

That would work... I guess what I was looking for was to define variables as
the rows that time1/2 starts and ends. Then I can use those variables to
define the ranges of the charts.

Is there an easy way to define these variables?
 
M

Matt S

I think I got it Jon... it will run slow, but it will work. Any way to speed
up this code?

Dim FirstData As Long
Dim LastData As Long

Range("AQ15").Select
Do Until Not ActiveCell = ""
Selection.Offset(1, 0).Select
Loop

FirstData = ActiveCell.Row

Do Until ActiveCell = ""
Selection.Offset(1, 0).Select
Loop

LastData = ActiveCell.Row - 1

Then I will use First and Last data variable to define my rows in the graphs.
 
J

Jon Peltier

Worksheet columns are cheap. Keep the original table as is, and use it for
display and for subsequent calculations. Then create another range that uses
formulas like =IF(LEN(B2)=0,NA(),B2), and use these columns for chart source
data.

- Jon
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top