Referencing data from another sheet

Janet_B

Board Regular
Joined
Dec 6, 2004
Messages
72
Hi,

I have data on a sheet like this:
Book2.xls
KLMN
470
480
49101
5061
5181
5211
5331
54171
55131
56121
57181
580
590
600
For O-C Eq


I use a date range (which can vary) in column L:L to indicate if to use the data or not in column K:K. The data is always together ie: no blank cells between the data in K:K.

On another sheet I would like the values in K:K to start from A1 down. For example in the above, A1 would be 10, A2 would be 6 etc etc

Thanks Janet.
 

Some videos you may like

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
Hello Janet,
I've got a couple of questions regarding your post.
(1) Are you looking for a VBA solution or a formula/sheet function?
(2) Are all the 1 values in column L going to be consecutive, or will there be zeros and 1s within the same date?
(3) What are your sheet names?
 

barry houdini

MrExcel MVP
Joined
Mar 23, 2005
Messages
20,825
You say "date range" in column L. Is that a typo or do you actually have dates in column L not 1s as shown in your example?

Presumably, in your example, A1 would be 10, A2 6 etc. then presumably that would go down to A9 with 18 then should A10 downward be blank?
 

Janet_B

Board Regular
Joined
Dec 6, 2004
Messages
72
Hi and thanks HalfAce,

(1) Are you looking for a VBA solution or a formula/sheet function?

I'd prefer a formula/sheet function but VBA would be fine too!


(2) Are all the 1 values in column L going to be consecutive, or will there be zeros and 1s within the same date?


Consecutive only.

(3) What are your sheet names?

Sheet 1 and sheet 2 :)

Thanks again.

Cheers Janet
 

Janet_B

Board Regular
Joined
Dec 6, 2004
Messages
72

ADVERTISEMENT

barry houdini said:
You say "date range" in column L. Is that a typo or do you actually have dates in column L not 1s as shown in your example?

Sorry yes it was a bit vague!

The 1's in column L reference 2 popup calendars (date range). The 1's indicate which values in column K are in the date range.

Presumably, in your example, A1 would be 10, A2 6 etc. then presumably that would go down to A9 with 18 then should A10 downward be blank?

Yes.

Cheers Janet[/quote]
 

Janet_B

Board Regular
Joined
Dec 6, 2004
Messages
72
Done loads of searching on this and I'm not really sure the best way to go with this. I found some code that removes blank cells but it removed everything!

Cheers Janet
 

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,453
Good morning Janet,
You should be able to use the AutoFilter function, perhaps like this. (Will run from any sheet.)
Code:
Sub Demo()
Application.ScreenUpdating = False
With Sheets("Sheet1")
    .Columns("K:L").AutoFilter Field:=2, Criteria1:="1"
    .Columns("K").SpecialCells(xlCellTypeVisible).Copy Sheets("Sheet2").[A1]
End With
Sheets("Sheet1").AutoFilterMode = False
Application.ScreenUpdating = True
End Sub
Hope it helps.
Dan
 

Watch MrExcel Video

Forum statistics

Threads
1,119,265
Messages
5,577,088
Members
412,764
Latest member
Brawler
Top