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.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"

HalfAce

MrExcel MVP
Joined
Apr 6, 2003
Messages
9,456
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,456
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,624
Messages
5,832,743
Members
430,160
Latest member
a_majda

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top