formula for moving information from one sheet to another sheet

P

Puzzled

I have information in column A of a task sheet. The information goes from row
1 thru 35. Column B is where I place a "x" to say the task need to be
completed. Is there a formula that can check each row in column B to see if
the "x" exist, until it reaches the end. If the "x" exist in any of the rows,
then move the information into a blank sheet called assignment. Example
B1,B3,B4,B20 all have a "x" in the field, now I need to move the information
in A1, A3, A4, A20 to row1 thru 4 of a blank work sheet. Is this possible.
 
F

FSt1

hi
not with a formula. formulas return value to the cell in which they reside.
they can not perform actions like move data to other specific cellls. you
would have to have the formulas set up on the blank sheet to do this.
what you want smells like a macro. not sure but i whipped this out. not to
pretty but it works.
right click your first sheet and from the pop up, click view code. paste the
below in the big white box. adjust sheet names and cell references to suit.
when you enter an "x" in column b, the contents of the cell next to the x in
column A will tranfer to sheet 2 column A.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim r As Range
Set r = Range("B:B")
If Selection.Count > 1 Then
Exit Sub
End If
If Intersect(Target, r) Is Nothing Then
Exit Sub
Else
If Target.Value <> "x" Then
Exit Sub
Else
Sheets("sheet2").Range("A65000").End(xlUp).Offset(1, 0) = _
Target.Offset(0, -1)
End If
End If
End Sub
 
P

Puzzled

Thank You very much

FSt1 said:
hi
not with a formula. formulas return value to the cell in which they reside.
they can not perform actions like move data to other specific cellls. you
would have to have the formulas set up on the blank sheet to do this.
what you want smells like a macro. not sure but i whipped this out. not to
pretty but it works.
right click your first sheet and from the pop up, click view code. paste the
below in the big white box. adjust sheet names and cell references to suit.
when you enter an "x" in column b, the contents of the cell next to the x in
column A will tranfer to sheet 2 column A.
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim r As Range
Set r = Range("B:B")
If Selection.Count > 1 Then
Exit Sub
End If
If Intersect(Target, r) Is Nothing Then
Exit Sub
Else
If Target.Value <> "x" Then
Exit Sub
Else
Sheets("sheet2").Range("A65000").End(xlUp).Offset(1, 0) = _
Target.Offset(0, -1)
End If
End If
End Sub
 
M

Max

You can use formulas to achieve the desired functionality in the new "blank"
sheet, dynamically

Assume your source data in Sheet1, in A2 down
In B2 down is where you will mark "x"

In your new "blank" sheet,
In A2: =IF(Sheet1!B2="x",ROW(),"")
In B2:
=IF(ROWS($1:1)>COUNT(A:A),"",INDEX(Sheet1!A:A,SMALL(A:A,ROWS($1:1))))
Copy A2:B2 down to cover the max expected extent of source data.
Hide/minimize col A. Col B will return the required results, all neatly
bunched at the top. voila? hit YES below. Easily modify the criteria in A2 to
suit what-you-want.
 
M

Max

In A2: =IF(Sheet1!B2="x",ROW(),"")
That's the criteria col, returns arb row nums for source rows
satisfying the criteria
Above is the extract and float-up results.
SMALL(A:A,ROWS($1:1)) returns the smallest arb row num from the
criteria col, and as it is copied down it'll return the 2nd smallest,
and so on by virtue of the incrementer ROWS($1:1) which returns the
series: 1,2,3,...
INDEX(Sheet1!A:A, .. then returns the corresponding results from
Sheet1's col A

COUNT(A:A) returns the number of arb row nums in col A, ie the number
of result lines. And once these are exhausted, the trap:
IF(ROWS($1:1)>COUNT(A:A),"",..
ensures that only blanks: "" will be returned, giving the neat clean
look
 

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