BrainDump
  Home arrow BrainDump arrow Page 3 - 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 FIND Function in MS Excel


    (Page 3 of 4 )

    The FIND function in MS Excel makes your work even more efficient, especially when combined with the MID function.

    Here is the definition of the FIND function in MS Excel:

    =FIND(find_text,within_text,[start_num])

    The "find text" is the character for which you are looking in the text. It can be only one character or even a block of text. You have to enclose the characters to be searched in between double quotes (").

    The "within_text" part refers to the cell location or address of the text to be analyzed, while "start_num" tells Excel where to start searching (is it in the first character or in the succeeding characters?).

    Here are some illustrative examples. One of the most difficult tasks of any webmaster is to extract the official URL out of the session ID-based URLs. Imagine that you are about to make a sitemap with the following URLs:

    http://www.yoursessionidbasedwebsite.com/file-x-y-1.html?osCsid=g25145xf

    http://www.yoursessionidbasedwebsite.com/file-x-y-2.html?osCsid=g25145xf

    http://www.yoursessionidbasedwebsite.com/file-x-y-3.html?osCsid=g25145xf

    http://www.yoursessionidbasedwebsite.com/file-x-y-4.html?osCsid=g25145xf

    http://www.yoursessionidbasedwebsite.com/file-x-y-5.html?osCsid=g25145xf

    http://www.yoursessionidbasedwebsite.com/file-x-y-6.html?osCsid=g25145xf

    The above example is simple because it is only used for illustration purposes; in real world filtering of session IDs, things can get pretty complicated, especially if you have other long and ugly characters in the URLs (aside from the session ID), such in today's modern dynamic websites.

    To take out the session ID above, you can analyze for similarities, just as we did in the MID function example previously. Note that all URLs have session IDs beginning with ?oSCsid, but we cannot filter by "?" since there could be other URLs with two "?" characters (in a real world session ID-based website) . Therefore we will want to find the location of osCid, and then use that location as the start of where things need to be filtered. For example, in this URL: http://www.yoursessionidbasedwebsite.com/file-x-y-4.php?osCsid=g25145xf , the location of "osCsid" is in the fifty-seventh character. So we will start filtering on the (57-2) = 55th character to include the "?" before the osCsid which is a part of the session ID. The result no longer contains the session ID.

    To implement the above example in Excel, copy and paste the six URLs above to an Excel worksheet starting in cell A1; the last one will occupy on cell A6. Remove the spaces in between.

    In cells B1 through B6, copy and paste the formula below:

    =FIND("?osCsid",A1,1)

    =FIND("?osCsid",A2,1)

    =FIND("?osCsid",A3,1)

    =FIND("?osCsid",A4,1)

    =FIND("?osCsid",A5,1)

    =FIND("?osCsid",A6,1)

    The above formula means we will start searching the first character, looking for "?osCsid".

    Finally, in cells C1 through C6, copy and paste the MID formula below, which will then extract the clean URL (without the session ID) in cells A1 through A6.

    =MID(A1,1,B1-2)

    =MID(A2,1,B2-2)

    =MID(A3,1,B3-2)

    =MID(A4,1,B4-2)

    =MID(A5,1,B5-2)

    =MID(A6,1,B6-2)

    After this text manipulation, you should have the same results as shown in the screen shot 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 4 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek