Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Moving scattered cell data to new column?

What I have is scattered data fields on a worksheet that are not organized
into one column. There is one common entry into every field but the rest of
the information is in numbers. Example: "PIN 012345" (Pin is in every cell,
but the numbers in every cell are not the same).

I want to move all found PIN data to a new column. Example: Cell rows 1
thru 40,000 all have the PIN entry, but in different columns. I need to
"Shift/Move" all the PIN data to a new column (without multiple commands for
each individual row of data).

Help anyone :-(

--
LarryW
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Moving scattered cell data to new column?

The following is just an example that you can adapt for your needs. It
assumes that column K is the destination column. It scans, row-by-row,
columns A thru J looking for cells starting with PIN. IF a cell is found, it
is moved to colum K

Sub pin_master()
Set r = ActiveSheet.UsedRange
n = r.Rows.Count + r.Row - 1
For i = 1 To n
For j = 1 To 10
If Left(Cells(i, j).Value, 3) = "PIN" Then
Cells(i, j).Copy Cells(i, "K")
Cells(i, j).Clear
End If
Next
Next
End Sub

--
Gary''s Student - gsnu200755


"LarryW" wrote:

What I have is scattered data fields on a worksheet that are not organized
into one column. There is one common entry into every field but the rest of
the information is in numbers. Example: "PIN 012345" (Pin is in every cell,
but the numbers in every cell are not the same).

I want to move all found PIN data to a new column. Example: Cell rows 1
thru 40,000 all have the PIN entry, but in different columns. I need to
"Shift/Move" all the PIN data to a new column (without multiple commands for
each individual row of data).

Help anyone :-(

--
LarryW

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 6
Default Moving scattered cell data to new column?

All sounds good Gary. However, where would I even "Start" I'm a Novice at
this and it looks like code here that would have to be generated for the
destination column. I'm sure I can do it, I just need to know step by step.
Thanks
--
LarryW


"Gary''s Student" wrote:

The following is just an example that you can adapt for your needs. It
assumes that column K is the destination column. It scans, row-by-row,
columns A thru J looking for cells starting with PIN. IF a cell is found, it
is moved to colum K

Sub pin_master()
Set r = ActiveSheet.UsedRange
n = r.Rows.Count + r.Row - 1
For i = 1 To n
For j = 1 To 10
If Left(Cells(i, j).Value, 3) = "PIN" Then
Cells(i, j).Copy Cells(i, "K")
Cells(i, j).Clear
End If
Next
Next
End Sub

--
Gary''s Student - gsnu200755


"LarryW" wrote:

What I have is scattered data fields on a worksheet that are not organized
into one column. There is one common entry into every field but the rest of
the information is in numbers. Example: "PIN 012345" (Pin is in every cell,
but the numbers in every cell are not the same).

I want to move all found PIN data to a new column. Example: Cell rows 1
thru 40,000 all have the PIN entry, but in different columns. I need to
"Shift/Move" all the PIN data to a new column (without multiple commands for
each individual row of data).

Help anyone :-(

--
LarryW

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default Moving scattered cell data to new column?

Here's an alternative worksheet function which could also deliver the results

Assuming "PIN" data is found scattered within cols A to J, data from row1
down, with only 1 instance per row (if any is found), then this array formula
will gather the PIN data in col K

Put in K1's formula bar, then press CTRL+SHIFT+ENTER to confirm the formula:
=IF(ISNA(MATCH(TRUE,ISNUMBER(SEARCH("PIN",A1:J1)), 0)),"",INDEX(A1:J1,MATCH(TRUE,ISNUMBER(SEARCH("PIN ",A1:J1)),0)))
Copy K1 down as far as required

-----
If you want to try out GS's subroutine suggestion, try these steps ..
Press Alt+F11 to go to VBE
In VBE, click Insert Module
Copy n paste all lines, inclusive,
from: Sub pin_master()
till: End Sub
into the code window on the right

Press Alt+Q to get back to Excel
In Excel, press Alt+F8 to bring up the Macro dialog
Double click directly on "pin_master" to run the sub
(or select "pin_master" click Run)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"LarryW" wrote:
All sounds good Gary. However, where would I even "Start" I'm a Novice at
this and it looks like code here that would have to be generated for the
destination column. I'm sure I can do it, I just need to know step by step.
Thanks
--
LarryW


  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Moving scattered cell data to new column?


Macros are very easy to install and use:

1. ALT-F11 brings up the VBE window
2. ALT-I
ALT-M opens a fresh module
3. paste the stuff in and close the VBE window

If you save the workbook, the macro will be saved with it.

To remove the macro:

1. bring up the VBE window as above
2. clear the code out
3. close the VBE window

To use the macro from Excel:

1. ALT-F8
2. Select the macro
3. Touch RUN

To learn more about macros in general, see:

http://www.mvps.org/dmcritchie/excel/getstarted.htm




--
Gary''s Student - gsnu200755


"LarryW" wrote:

All sounds good Gary. However, where would I even "Start" I'm a Novice at
this and it looks like code here that would have to be generated for the
destination column. I'm sure I can do it, I just need to know step by step.
Thanks
--
LarryW


"Gary''s Student" wrote:

The following is just an example that you can adapt for your needs. It
assumes that column K is the destination column. It scans, row-by-row,
columns A thru J looking for cells starting with PIN. IF a cell is found, it
is moved to colum K

Sub pin_master()
Set r = ActiveSheet.UsedRange
n = r.Rows.Count + r.Row - 1
For i = 1 To n
For j = 1 To 10
If Left(Cells(i, j).Value, 3) = "PIN" Then
Cells(i, j).Copy Cells(i, "K")
Cells(i, j).Clear
End If
Next
Next
End Sub

--
Gary''s Student - gsnu200755


"LarryW" wrote:

What I have is scattered data fields on a worksheet that are not organized
into one column. There is one common entry into every field but the rest of
the information is in numbers. Example: "PIN 012345" (Pin is in every cell,
but the numbers in every cell are not the same).

I want to move all found PIN data to a new column. Example: Cell rows 1
thru 40,000 all have the PIN entry, but in different columns. I need to
"Shift/Move" all the PIN data to a new column (without multiple commands for
each individual row of data).

Help anyone :-(

--
LarryW

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Best way to total scattered data? Angyl Excel Discussion (Misc queries) 5 October 30th 07 06:38 PM
XL 2007 : Cant move data values (scattered points) in XY Scatter c Tushar Halarnkar Setting up and Configuration of Excel 0 March 8th 07 11:27 PM
moving column/cell data to rows/cells fails Richard RE Excel Worksheet Functions 0 June 20th 06 06:05 AM
time scale-x with scattered data-y searching for answer Charts and Charting in Excel 1 July 20th 05 09:06 PM
moving data within a column Kathy Excel Worksheet Functions 1 December 6th 04 08:24 PM


All times are GMT +1. The time now is 04:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"