#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default De-identify data

Hello,

I'm new to this group

I've got a "student names" column (about 3000 names) and a "student
comments" column (about 23,000 comments). I would like to replace all names
appearing in "student comments" entries with an X by matching with entries in
"student names" column.

Is there a way of automating this with an Excel function? I'm using Excel
2007 and am a "basic" Excel user.

Thanks in advance
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default De-identify data

Let's assume that the names are in column A and the comments are in column B.
Enter and run this small macro:

Sub Macro2()
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
v = Cells(i, "A").Value
Columns("B:B").Replace What:=v, Replacement:="X", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next
End Sub

Data that starts out looking like:

John Smith John Smith is nice.
Mary Mary is good
James James is better
Larry
Moe
Curley

will become:

John Smith X is nice.
Mary X is good
James X is better
Larry
Moe
Curley


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 - gsnu200787


"Eilean" wrote:

Hello,

I'm new to this group

I've got a "student names" column (about 3000 names) and a "student
comments" column (about 23,000 comments). I would like to replace all names
appearing in "student comments" entries with an X by matching with entries in
"student names" column.

Is there a way of automating this with an Excel function? I'm using Excel
2007 and am a "basic" Excel user.

Thanks in advance

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default De-identify data

Thank you very, very much!! Exactly what I was after!

All the best,

Eilean


"Gary''s Student" wrote:

Let's assume that the names are in column A and the comments are in column B.
Enter and run this small macro:

Sub Macro2()
n = Cells(Rows.Count, "A").End(xlUp).Row
For i = 1 To n
v = Cells(i, "A").Value
Columns("B:B").Replace What:=v, Replacement:="X", LookAt:=xlPart, _
SearchOrder:=xlByRows, MatchCase:=False, SearchFormat:=False, _
ReplaceFormat:=False
Next
End Sub

Data that starts out looking like:

John Smith John Smith is nice.
Mary Mary is good
James James is better
Larry
Moe
Curley

will become:

John Smith X is nice.
Mary X is good
James X is better
Larry
Moe
Curley


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 - gsnu200787


"Eilean" wrote:

Hello,

I'm new to this group

I've got a "student names" column (about 3000 names) and a "student
comments" column (about 23,000 comments). I would like to replace all names
appearing in "student comments" entries with an X by matching with entries in
"student names" column.

Is there a way of automating this with an Excel function? I'm using Excel
2007 and am a "basic" Excel user.

Thanks in advance

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
Formula to Identify Col Data-Pairs that Differ by 2*pi monir Excel Worksheet Functions 2 November 22nd 07 03:47 AM
Identify last row of populated data Jumbo Shrimps, Jr. Excel Worksheet Functions 2 April 8th 07 08:03 AM
identify duplicate data upon entry of that data Jan Buckley Excel Discussion (Misc queries) 5 December 21st 06 10:11 PM
identify different data in two columns fitzy Excel Discussion (Misc queries) 2 July 20th 05 11:13 AM
identify data in a cell that has a number as the second character Brian Excel Worksheet Functions 1 December 12th 04 03:23 PM


All times are GMT +1. The time now is 12:07 PM.

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

About Us

"It's about Microsoft Excel"