+ Reply to Thread
Results 1 to 4 of 4

Moving Text from One cell to another if it matches some set text

  1. #1
    Registered User
    Join Date
    10-17-2014
    Location
    Lincoln, Nebraska
    MS-Off Ver
    2010
    Posts
    3

    Question Moving Text from One cell to another if it matches some set text

    Not sure if this has to be done using a VBA macro or if there are formulas that can be used. It's been a few years since I was in high school and learning about using excel so a lot of my knowledge in this area has faded as I made room for different tasks. My current goal is to take an access database we have containing information about 1600 or so people and move it to our web based SQL server for better functionality. I have wrote the database and all the working reports for our web based database but our last step is to move over the 1600 people which can be easily imported, the problem is that the database scheme doesn't match the layout that it is in from the Access database. To give you an idea something in the Access Database may look like:

    General Information
    Something, Something1, Something2

    where General Information is the Column Heading and the comma separated list is the column information. This in the online database is not something that requires parsing, it would be 3 seperate columns that contains the value of whatever it is instead of 1 column with all values seperated by commas. so.

    Something | Something1 | Something2
    Something | Something1 | Something2

    Where Each column ends at the "|"

    Is there a script that we could run on "General Information" where General information is some arbitrary column, we'll say C1 that would do something like

    If C1 contains the string "something" write "something" in Column D1

    D1 would be a new column named Something and At the conclusion of running the script across the 1600 results I could just delete the entire General information column.

    How it is set up "something" would just be written in the new column and could be some user defined string. so "write 'something'" 'something' could equal anything I wish to set it equal to not just the value of "general information" (C1).

    I am not sure how clear I am being but if you need more clarification please comment and I will do my best to address any questions. I haven't worked with VB in years and wouldn't know where to start with the VBA integration with excel. The reason we are straying from access is because our Access Database Administrator recently passed away and instead of reeducation someone to fill her position we figured we'd remake the application in a domain that more and more people can actively manipulate (php + sql). I am not a VBA expert and really hope that I can get this done without having to write a macro, time isn't a huge deal but I don't want to think about how much time it would take me to write the macros.

    Any help would be much appreciated.

    Attached image of how it will work:
    Sample.PNG
    Last edited by andylpsx; 10-24-2014 at 04:00 PM.

  2. #2
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Moving Text from One cell to another if it matches some set text

    Hi andylpsx,
    Welcome to the Forum.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and use the paperclip icon to open the upload window.

    View Pic
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  3. #3
    Registered User
    Join Date
    10-17-2014
    Location
    Lincoln, Nebraska
    MS-Off Ver
    2010
    Posts
    3

    Re: Moving Text from One cell to another if it matches some set text

    I added a picture to address any confusion.

  4. #4
    Registered User
    Join Date
    10-17-2014
    Location
    Lincoln, Nebraska
    MS-Off Ver
    2010
    Posts
    3

    Re: Moving Text from One cell to another if it matches some set text

    Since apperently no one else knows the answer I figured I share it with anyone else wondering the same thing.

    To do this, you'll probably want to use either the FIND or SEARCH function (most likely SEARCH).

    To learn about the FIND function, take a look at the video and e-book lesson: Expert Skills Lesson 3-21: Extract text from delimited strings using the FIND and LEN functions.
    The only difference between SEARCH and FIND is that FIND is case sensitive and SEARCH is not, so SEARCH would find "carolyn", "Carolyn", "CaRoLyN", etc, while FIND would only find "carolyn".

    Here's how the SEARCH formula looks:

    =SEARCH(A1,"carolyn")

    ...but that's only one piece of the puzzle, since the SEARCH function will just return a number indicating the location of the text you're searching for. To check whether or not the SEARCH function found the text, you'll need to use the ISNUMBER function:

    =ISNUMBER(SEARCH(A1,"carolyn")

    ISNUMBER will return "TRUE" if carolyn was found and "FALSE" if it wasn't. This may fulfil all of your needs, but you can make this even more flexible by using the IF function. IF functions are covered in Expert Skills Lesson 3-5: Use the IF logic function. Here's how the final formula will look:

    =IF(ISNUMBER(SEARCH("carolyn",A1)),"Yes","No")

    This formula will return "Yes" if cell A1 contains the word "carolyn" anywhere in its text and will return "No" if it doesn't.
    Source: Here

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Vlookup for text and add relevant values if text matches in the range
    By misys.til in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-19-2014, 06:11 AM
  2. Replies: 2
    Last Post: 08-05-2013, 07:32 PM
  3. If Cell Text Matches Any Text From Range, Then Apply VLOOKUP?
    By eliot1171 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 04-12-2013, 09:41 PM
  4. [SOLVED] Macro to check row's text colour and if text in below rows matches
    By Raulus in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-22-2012, 06:28 AM
  5. Replies: 5
    Last Post: 03-06-2008, 01:27 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1