BrainDump
  Home arrow BrainDump arrow Page 2 - Advanced String Manipulation Using MS Exce...
ASP Free Forums 
.NET  
ASP  
ASP Code  
ASP.NET  
ASP.NET Code  
BrainDump  
C#  
Code Examples  
Database  
Database Code  
IIS  
Microsoft Access  
MS SQL Server  
Silverlight  
Visual Basic.NET  
Windows Scripting  
Windows Security  
XML  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
ASP Web Hosting  
ASP.NET Web Hosting 
Windows Web Hosting
 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
BRAINDUMP

Advanced String Manipulation Using MS Excel
By: Codex-M
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 4
    2009-06-10

    Table of Contents:
  • Advanced String Manipulation Using MS Excel
  • The MID Function in MS Excel
  • The FIND Function in MS Excel
  • The LEN function in MS Excel

  • Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
     
    ADVERTISEMENT


    Advanced String Manipulation Using MS Excel - The MID Function in MS Excel


    (Page 2 of 4 )

    The MID function is not known or popular to any ordinary MS Excel user, yet it is a very powerful function. Its purpose is to extract a block of text within a longer block of text, or in short, it extracts short text within text. Consider the following example.

    Say you have the following data in your MS Excel spreadsheet:

    1.) What is your name?

    2.) Do you know how to use the mid function?

    3.) Are you sure you can do this complicated Excel job?

    And someone ask you to take out the numbers, so that it will just be:

    What is your name?

    Do you know how to use the mid function?

    Are you sure you can do this complicated Excel job?

    You may be laughing at this example, as it can be done manually fast. But note that there are times when you will be asked to process around 100 or even 1,000 rows of data. In that situation, doing it manually can take ages. Thus, extensive knowledge of string manipulation will make your work go more quickly and make you an efficient person when it comes to handling spreadsheet-related jobs.

    To solve this problem, copy and paste the above text (with numbers) into an Excel spreadsheet starting on Cell A1, the second question on Cell A2 and the last one on Cell A3.

    Now we will define the MID function:

    =mid(text, start_num, num_chars)

    "Text" is the cell number/location of your text. "Start_num" is where Excel starts picking up characters for your new text. "Num_chars" is the number of characters to be picked up, starting from "Start_num."

    To determine the "start_num" of the above example, we will analyze the text for consistencies or patterns. Note that, as instructed, we will be removing the number; for example, "1.)"

    So if we count starting with the character "1" until ")" and including the space after it, it comprises four characters.

    This means that the desired text starts on every fifth character. This is true for the text in all three cells.

    Now we will determine what the "Num chars" are in the example above. Since the length of the characters of the text to be extracted in cell A1 until cell A3 differs a lot, we can set it to "1000." This ensures that the text extracted will not be cut off (especially in longer sentences).

    Finally, we are now ready to use the MID function to grab the text we want.

    The respective MID formula to extract the text in the illustrated example above:

    =MID(A1,5,1000)

    =MID(A2,5,1000)

    =MID(A3,5,1000)

    To use this within the Excel spreadsheet, copy and paste the formula above to cells B1 through B3. This will now grab the text as shown below:

    More BrainDump Articles
    More By Codex-M


     

    BRAINDUMP ARTICLES

    - Introduction to Office Live Workspace
    - Using MS Excel for One-way Analysis of Varia...
    - Comparing Data Sets Using Statistical Analys...
    - Import Blogger Posts into WordPress Using Wi...
    - Download WordPress from an FTP Server and Ru...
    - Install and Run WordPress in XAMPP Local Host
    - What Windows 7 Brings to the Table
    - Virtualization and Sandbox Detection
    - Advanced Firebug Techniques in Windows XP Ho...
    - Editing CSS with Firebug in Windows XP Home
    - Using Firebug in Windows XP Home
    - Migrating to Exchange Server 2007
    - Using System Restore on a Non-Bootable PC
    - Finding Logged on Users and More Scripting S...
    - Developing Macro Commands in MS Excel





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek