+ Reply to Thread
Results 1 to 8 of 8

Macro to Normalize Data

  1. #1
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    263

    Macro to Normalize Data

    I have been getting spreadsheets from an OCR program and attempting to clean it up. One issue that I have is that I have two columns, one with an SSN and the other with a name, and sometimes the name is either spelled differently or misread by the OCR. I am looking to get the "max" value for the name (by length), but a pivot table only works for numbers. I do not want to use a formula, but rather a VBA approach so that I can select the cells (e.g. A2:B9) and values in B2:B9 automatically show the max name value for each name.

    See attached spreadsheet. Any ideas? Thanks.
    Attached Files Attached Files

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,888

    Re: Macro to Normalize Data

    How will you determine the max value (length) for Smith, Robert and Smith, Robbie as they both will have the same length. Same for Doe John and D0e John. What is your secondary criteria or how will you tell Excel through VBA to select Robert over Robbie?
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    263

    Re: Macro to Normalize Data

    Good point..I guess whichever one is first..so long as only one is used.

  4. #4
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: Macro to Normalize Data

    Hi,

    I'd still be inclined to use an Excel function even if you get VBA to add it for you.

    In C2:
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    In D2 as an array formula entered with Ctrl-Shift-Enter
    Formula: copy to clipboard
    Please Login or Register  to view this content.


    Copy both down and then use the 'Remove Duplicates functionality on column D to list the final names.
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  5. #5
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Macro to Normalize Data

    even if same-valued entries in Col A aren't all next to each other
    Please Login or Register  to view this content.

  6. #6
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    263

    Re: Macro to Normalize Data

    Thanks Kalak..that is exactly what I was looking for.

  7. #7
    Valued Forum Contributor
    Join Date
    03-21-2013
    Location
    cyberia
    MS-Off Ver
    Excel 2007
    Posts
    457

    Re: Macro to Normalize Data

    Glad to help.

    If you want a simpler, easier to understand(?) macro (my earlier was rather unnecessarily complex overkill) where all the like 111-11-1111 etc. are consecutive, then
    Please Login or Register  to view this content.

  8. #8
    Forum Contributor
    Join Date
    09-04-2013
    Location
    USA
    MS-Off Ver
    Excel 365
    Posts
    263

    Re: Macro to Normalize Data

    Either one will work.. Thanks again...

+ 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. Normalize data
    By MrKickAss in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-17-2014, 12:13 PM
  2. Normalize Data on a Chart for Correlation
    By rziegler in forum Excel General
    Replies: 1
    Last Post: 08-13-2009, 10:11 AM
  3. How to normalize data
    By excellicious in forum Excel General
    Replies: 3
    Last Post: 02-05-2009, 11:20 PM
  4. VB Macro to normalize a table
    By hasardeux in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 01-20-2009, 08:24 AM
  5. problem to normalize data
    By alnnbutms in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-19-2006, 07:40 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