Log in

View Full Version : Excel line graph


hoyos
Jun 28, 2008, 01:36 AM
I have a line graph which that's its data from a separate worksheet. On that sheet I have displayed the days of which ever month I select down column "A". Obviously some month have 30 days and other have 31.
Column "B" has total hours flown that day (format: 00:00) and column "C" has a running total (same format). See below and example:
A B C
01-May-08 02:55 02:55
02-May-08 01:20 04:15
03-May-08 02:35 06:50
04-May-08 03:20 10:10
05-May-08 03:55 14:05
06-May-08 01:00 15:05
07-May-08 00:30 15:35
08-May-08 01:50 17:25
09-May-08 01:50 19:15
10-May-08 02:50 22:05
11-May-08 03:40 25:45
12-May-08 02:35 28:20
13-May-08 00:40 29:00
14-May-08 02:00 31:00
15-May-08 01:30 32:30
16-May-08 01:35 34:05
17-May-08 02:30 36:35
18-May-08 02:40 39:15
19-May-08 01:45 41:00
20-May-08 02:00 43:00
21-May-08 01:10 44:10
22-May-08 01:15 45:25
23-May-08 01:20 46:45
24-May-08 02:40 49:25
25-May-08 00:50 50:15
26-May-08 00:35 50:50
27-May-08 00:00 50:50
28-May-08 00:00 50:50
29-May-08 00:00 50:50
30-May-08 00:00 50:50
31-May-08 00:00 50:50

Column "A29:A31" formula is: =IF(A28+1>DATE(YEAR($A1),MONTH($A1)+1,0),"",A28+1)

Column "B1:B31" formula is taken from a sheet named MAIN: =SUMPRODUCT(--(MONTH(MAIN!$A$10:$A$4999)=MONTH($G$1)),--(DAY(MAIN!$A$10:$A$4999)=DAY($A2)),MAIN!$D$10:$D$4 999)

Column "C2:C31" formula is: =IF(A2="",NA(),IF(B2=0,C1+B2,C1+B2))

The problem I am having, in this example, is the days totals from the 27th onwards have not been entered therefore it shows "00:00". That carries the running totals down to the end of the month, producing a flat line on the graph.
The question is:
How do I stop it from producing that flat line on the graph?

ISneezeFunny
Jun 28, 2008, 01:48 AM
Easiest way to do this is if you click on the actual line in the graph and then reference back to the excel data sheet, the area the line is referenced to should be highlighted with a blue outline. Now take the lower right corner of this blue outline and drag it up to only highlight the portions of the data that is entered. Of course, now the line graph will be shorter.

hoyos
Jun 28, 2008, 02:24 AM
Sorry Funny,
I don't get any highlighted areas, but I did notice when I clicked on the graph line, on the formula bar I have the following:
=SERIES(,Sheet5!$A$1:$A$31,Sheet5!$C$1:$C$31,1)
Maybe using OFFSET in it may work!!

ISneezeFunny
Jun 28, 2008, 02:28 AM
well technically you just don't want that part of the graph to be there (to just cut it off)

so you can change the formula bar to:

=SERIES(,Sheet5!$A$1:$A$28,Sheet5!$C$1:$C$28,1)

see if that helps.

hoyos
Jun 28, 2008, 03:18 AM
Sorry to be such a pain!
Yes that cuts the line off, but I need to be able to add new data and the line to continue.
So that formula needs to go allthe way to 31.

ISneezeFunny
Jun 28, 2008, 07:19 AM
I see. In that case, I suggest you add data later and then change formula back later on.