Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default replacing contents of a cell with data froma list/file

Hi

I guess most things can be done but what I need to know is urgent and
I hope someone may be able to assist quickly,

I have a speard sheet with a grid listing on it with names like
Midlands 1 midlands 2 Southwest 1 and soutwest 2 etc etc

What I would like is a quick method of replacing these cells of data
with real names.

e.g all occurances of Midlands 1 replaced with Fred Smith

Midlands 2 replaced with joe brown etc etc

rather like mail merge in word.

I know I can do simple find and replace but its rather time consuming!

Thanks in advance

Regards Andy T



--
For users by users - BY-users group
<http://www.by-users.co.uk
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default replacing contents of a cell with data froma list/file

One way is to use a helper sheet ..

Assume your source data is within say, A2:K100 in Sheet1
and your lookup list is in Sheet2, cols A and B, viz:

Midlands 1 Fred Smith
Midlands 2 George K

etc

In a new sheet,
Place in A2:
=IF(Sheet1!A2="","",IF(ISNA(VLOOKUP(Sheet1!A2,Shee t2!$A:$B,2,0)),Sheet1!A2,VLOOKUP(Sheet1!A2,Sheet2! $A:$B,2,0)))
Copy across/down to K100. This returns the source range in Sheet1 with the
replacements that you want done while leaving other source cells "intact".
Then just copy A2:K100 & paste special as values to overwrite the source
range in Sheet1. Delete away the new sheet.
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Andy T" wrote in message
...
Hi

I guess most things can be done but what I need to know is urgent and
I hope someone may be able to assist quickly,

I have a speard sheet with a grid listing on it with names like
Midlands 1 midlands 2 Southwest 1 and soutwest 2 etc etc

What I would like is a quick method of replacing these cells of data
with real names.

e.g all occurances of Midlands 1 replaced with Fred Smith

Midlands 2 replaced with joe brown etc etc

rather like mail merge in word.

I know I can do simple find and replace but its rather time consuming!

Thanks in advance

Regards Andy T



--
For users by users - BY-users group
<http://www.by-users.co.uk



  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 116
Default replacing contents of a cell with data froma list/file

You can also use a macro to complete the task. Add other replacement values
to suit. This will replace all instances of each.

Sub ChangeToName()
Application.ScreenUpdating = False

Cells.Replace What:="Midlands 1", Replacement:="Fred Smith", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

Cells.Replace What:="Midlands 2", Replacement:="Joe Brown", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

Cells.Replace What:="Southwest 1", Replacement:="Fred Brown", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

Cells.Replace What:="Southwest 2", Replacement:="Joe Smith", LookAt:= _
xlPart, SearchOrder:=xlByRows, MatchCase:=False,
SearchFormat:=False, _
ReplaceFormat:=False

Application.ScreenUpdating = True
End Sub


Regards,

Alan



"Andy T" wrote in message
...
Hi

I guess most things can be done but what I need to know is urgent and
I hope someone may be able to assist quickly,

I have a speard sheet with a grid listing on it with names like
Midlands 1 midlands 2 Southwest 1 and soutwest 2 etc etc

What I would like is a quick method of replacing these cells of data
with real names.

e.g all occurances of Midlands 1 replaced with Fred Smith

Midlands 2 replaced with joe brown etc etc

rather like mail merge in word.

I know I can do simple find and replace but its rather time consuming!

Thanks in advance

Regards Andy T



--
For users by users - BY-users group
<http://www.by-users.co.uk



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default replacing contents of a cell with data froma list/file

On Sat, 17 Mar 2007 11:57:59 +0800, "Max"
wrote:

One way is to use a helper sheet ..

Assume your source data is within say, A2:K100 in Sheet1
and your lookup list is in Sheet2, cols A and B, viz:

Midlands 1 Fred Smith
Midlands 2 George K

etc

In a new sheet,
Place in A2:
=IF(Sheet1!A2="","",IF(ISNA(VLOOKUP(Sheet1!A2,She et2!$A:$B,2,0)),Sheet1!A2,VLOOKUP(Sheet1!A2,Sheet2 !$A:$B,2,0)))
Copy across/down to K100. This returns the source range in Sheet1 with the
replacements that you want done while leaving other source cells "intact".
Then just copy A2:K100 & paste special as values to overwrite the source
range in Sheet1. Delete away the new sheet.



Thanks mate but that is way above my abilities.

I may be able to use it in future now I have something to learn but as
I need it for 7am in the morning I guess its easier to do it long
hand.

Thanks for your time and assistance!

Regards Andy T



--
For users by users - BY-users group
<http://www.by-users.co.uk
  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default replacing contents of a cell with data froma list/file

No problem. But it's really quite simple to set-up and complete. Keep the
steps handy for another time when you might need to do it for a huge source
range, say A2:IV65000 <g
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"Andy T" wrote
Thanks mate but that is way above my abilities.

I may be able to use it in future now I have something to learn but as
I need it for 7am in the morning I guess its easier to do it long
hand.

Thanks for your time and assistance!

Regards Andy T



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
Concatenate cells, replacing blanks with cell contents from other rows [email protected] Excel Worksheet Functions 10 February 21st 07 03:16 PM
Replacing Contents of 1 Cell to Another. John1950 Excel Discussion (Misc queries) 3 September 23rd 05 06:26 PM
lookup value froma filtered list Eric Excel Worksheet Functions 4 July 15th 05 12:48 AM
how does excel read only odd numbered rows of data froma column? Rose_mina Excel Worksheet Functions 3 May 15th 05 05:22 PM
convert cell contents to different data file format adam Excel Worksheet Functions 2 April 10th 05 08:39 PM


All times are GMT +1. The time now is 11:24 PM.

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"