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

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
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?
 
Upvote 0
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?
 
Upvote 0
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
 
Upvote 0
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]
 
Upvote 0
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
 
Upvote 0
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
 
Upvote 0

Forum statistics

Threads
1,214,972
Messages
6,122,530
Members
449,088
Latest member
RandomExceller01

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
Back
Top