Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

find and replace values

Posted on 2013-12-29
2
353 Views
Last Modified: 2013-12-30
folks

based on a value in sheet 1 field b1 I would like to loop thru sheet 2 the entire column "a" and find and replace values containing "car" with  the word "transport"
if sheet 1 b1 = 1 then replace values that are months with seaons

i.e

if sheet 1 b1 = "1"

the replace "car" with  "transport"

if

if sheet 1 b1 = "2"

the replace "snacks" with  "food"

if sheet 1 b1 = "3"

the replace "pills" with  "medicine"
0
Comment
Question by:rutgermons
2 Comments
 

Author Comment

by:rutgermons
ID: 39745158
I guess substitute may be the better term used for this
0
 
LVL 69

Accepted Solution

by:
Qlemo earned 500 total points
ID: 39745297
In Excel VBA:
Sub SubstA()
  strFind = ""
  strRepl = ""
  Select Case [Sheet1!B1].Value
    Case 1: strFind = "car": strRepl = "transport"
    Case 2: strFind = "snacks": strRepl = "food"
    Case 3: strFind = "pills": strRepl = "medicine"
  End Select
  [Sheet2!A:A].Replace strFind, strRepl, xlWhole
End Sub

Open in new window

Calling that sub (macro) should perform that simple task.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
This code takes an Excel list of URL’s and adds a header titled “URL List”. It then searches through all URL’s in column “A”, looking for duplicates. When a duplicate is found, it is moved to the top of the list. The duplicate URL’s are then highlig…
This Micro Tutorial will demonstrate in Google Sheets how to use the HYPERLINK function to create live links inside your spreadsheet.
Many functions in Excel can make decisions. The most simple of these is the IF function: it returns a value depending on whether a condition you describe is true or false. Once you get the hang of using the IF function, you will find it easier to us…

791 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question