Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
DK DK is offline
external usenet poster
 
Posts: 21
Default Extracting specific data from one column to another column

I am trying to filter data from a directory listing in excel but not
too good at it ;o)

The task on hand is to extract the directory name / document class from
column C and display in Column H. The directory name for document class
are :

C or Corr or Correspondence - it needs to be shown in Column H as
Correspondence
A or Agree - it needs to be shown in Column H as Agreement
M or Memos - it needs to be shown in Column H as Memos
P or Pleadings - it needs to be shown in Column H as Pleadings

Now, the tricky part is that these appear at different places in each
cell. There is no specific location for each directory. But P, C, A,
Corr, Correspondence, Agree, Memo, Pleadings all are directories and
would have a backslash "\" preceeding or succeeding it.

P:\DAVID\00019\abc.wpd
P:\DAVID\00019\C\XYZ.wpd
P:\DAVID\00019\P\KLM.wpd
P:\DAVID\00019\Pleadings\ABCDEF.wpd
P:\DAVID\00019\POST\Correspondence\abc.wpd

Please help with a macro code.

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6,953
Default Extracting specific data from one column to another column

Sub CodeData()
For Each cell In Range("C2:C20")
v = Split(cell.Value, "\")
s = ""
For i = LBound(v) To UBound(v) - 1

Select Case LCase(v(i))
Case "c", "correspondence"
s = "Correspondence"
Case "a", "agree"
s = "Agree"
Case "m", "memo", "memos"
s = "Memo"
Case "p", "pleading", "pleadings"
s = "Pleading"
End Select
If s < "" Then
cell.Offset(0, 5).Value = s
Exit For
End If
Next i
Next cell

End Sub

--
Regards,
Tom Ogilvy


"DK" wrote:

I am trying to filter data from a directory listing in excel but not
too good at it ;o)

The task on hand is to extract the directory name / document class from
column C and display in Column H. The directory name for document class
are :

C or Corr or Correspondence - it needs to be shown in Column H as
Correspondence
A or Agree - it needs to be shown in Column H as Agreement
M or Memos - it needs to be shown in Column H as Memos
P or Pleadings - it needs to be shown in Column H as Pleadings

Now, the tricky part is that these appear at different places in each
cell. There is no specific location for each directory. But P, C, A,
Corr, Correspondence, Agree, Memo, Pleadings all are directories and
would have a backslash "\" preceeding or succeeding it.

P:\DAVID\00019\abc.wpd
P:\DAVID\00019\C\XYZ.wpd
P:\DAVID\00019\P\KLM.wpd
P:\DAVID\00019\Pleadings\ABCDEF.wpd
P:\DAVID\00019\POST\Correspondence\abc.wpd

Please help with a macro code.


  #3   Report Post  
Posted to microsoft.public.excel.programming
DK DK is offline
external usenet poster
 
Posts: 21
Default Extracting specific data from one column to another column

Hi Tom,
Works superb! Thanks a ton!
Regards
Dilpreet
Tom Ogilvy wrote:

Sub CodeData()
For Each cell In Range("C2:C20")
v = Split(cell.Value, "\")
s = ""
For i = LBound(v) To UBound(v) - 1

Select Case LCase(v(i))
Case "c", "correspondence"
s = "Correspondence"
Case "a", "agree"
s = "Agree"
Case "m", "memo", "memos"
s = "Memo"
Case "p", "pleading", "pleadings"
s = "Pleading"
End Select
If s < "" Then
cell.Offset(0, 5).Value = s
Exit For
End If
Next i
Next cell

End Sub

--
Regards,
Tom Ogilvy


"DK" wrote:

I am trying to filter data from a directory listing in excel but not
too good at it ;o)

The task on hand is to extract the directory name / document class from
column C and display in Column H. The directory name for document class
are :

C or Corr or Correspondence - it needs to be shown in Column H as
Correspondence
A or Agree - it needs to be shown in Column H as Agreement
M or Memos - it needs to be shown in Column H as Memos
P or Pleadings - it needs to be shown in Column H as Pleadings

Now, the tricky part is that these appear at different places in each
cell. There is no specific location for each directory. But P, C, A,
Corr, Correspondence, Agree, Memo, Pleadings all are directories and
would have a backslash "\" preceeding or succeeding it.

P:\DAVID\00019\abc.wpd
P:\DAVID\00019\C\XYZ.wpd
P:\DAVID\00019\P\KLM.wpd
P:\DAVID\00019\Pleadings\ABCDEF.wpd
P:\DAVID\00019\POST\Correspondence\abc.wpd

Please help with a macro code.



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
Selecting data from a specific column Charp Excel Discussion (Misc queries) 1 December 8th 09 05:29 PM
extracting specific values and replacing in set column hudini Excel Discussion (Misc queries) 5 September 3rd 07 05:16 PM
About sorting and extracting data in one column Ting Li Excel Worksheet Functions 7 June 9th 07 01:59 AM
Populate a column by extracting unique values from another column? Mike Palmer Excel Worksheet Functions 2 June 10th 05 03:21 PM
SUM/COUNT column(s) based on specific value present within the column markx Excel Worksheet Functions 6 March 22nd 05 10:23 AM


All times are GMT +1. The time now is 01:56 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"