Using VBA To Clean Up Imported Data

Mar 17, 2009

Using VBA to clean up imported data ...

View 9 Replies


ADVERTISEMENT

VBA To Clean Data Set

Jul 7, 2009

Sheet1

A1Bad Data2Bad Data3Bad Data4Bad Data5Bad Data6Bad Data7Bad Data8Bad Data9Bad Data10Bad Data11Title12Good Data13Good Data14Good Data15Good Data16Good Data17Good Data18Good Data19Good Data20Good Data21Good Data22 23Bad Data24Bad Data25Bad Data26Bad Data27Bad Data28Bad Data29Bad Data30Bad Data31Bad Data32Bad Data33Bad Data34Bad Data35Bad Data

Excel tables to the web >> http://www.excel-jeanie-html.de/index.php?f=1" target="_blank"> Excel Jeanie HTML 4

How can I ensure that all Rows before "Title" and all Rows after the last populated Row (denoted by the fact that there is a single blank Cell after it) are completely deleted?

View 9 Replies View Related

Emailing Clean Data From Excel?

Jun 25, 2013

I am building a weekly email to my clients giving them some data on their account. When i send through file-> Share as html email, the formatting gets all screwy.

View 2 Replies View Related

Clean Up Data In Contact Sheets?

Dec 2, 2013

I am putting together a master sheet of 1000s of contacts for colleagues taken from various sources (outlook contact download, linked in download, inputted business cards etc). I have noticed that everyone has their own way of using outlook and the data (normally addresses and phone numbers) appear in different columns and formats. I have used the function concatenate to add zeros back to numbers if i have had to use .csv as the download output, but I have the issue of mobile numbers in the wrong columns (i.e. someone has put a mobile number as the business phone). Is there a way of creating a new column and then applying a logic formula of some kind saying if a number starts with 07 then it appears in the new column, but if it doesnt then to ignore it therefore separating the mobile numbers so I can add to the correct column?

View 1 Replies View Related

Clean And Copy Data From One Worksheet To Another?

Jun 23, 2012

I need to clear the worksheet named 'ZWM0104' then have to eliminate the lines 1, 3, 5 and the columns 'A' and 'C' of the worksheet named 'Cobaia_ZWM0104' done that need to copy all cells with data from the spreadsheet called 'Cobaia_ZWM0104' to the worksheet named 'ZWM0104'

i'm try...

Code:
Sub teste()
Application.ScreenUpdating = 0
Worksheets("ZWM0104").Range("A:N").Delete
Worksheets("Cobaia_ZWM0104").Select

[Code].....

View 7 Replies View Related

To Clean Out Unnecessary Data From A File

Mar 24, 2007

I need to clean out unnecessary data from a file, (see this example text file Link),
I'm not sure how to go about this in excel,

basically every file starts with 9 cells that needs to be deleted, then two cells of real data then one with garbage that needs to be deleted, it goes like that for 40 cells,
then again 10 cells of garbage that needs to be deleted, then 40 of real data and goes like that up to 3000 lines,

I know it sounds confusing but if you take a look at linked file from above it will make more sense, (to save it right click on "clean up.txt" and then save target as)

at the end I need to have all cells full of data

View 9 Replies View Related

Clean Data - Removing Unwanted Characters

Feb 25, 2007

I have an excel sheet with approx 30,000 rows of data.

These are all keyword phrases.

They can be related to any subject, but for this example these are related to the root keyword phrase of "car Rent"

I have some software which basically pulls in keyword phrases from search engines and meta tags etc, including misspelled keyword phrases.

My problem;

The data is uncleaned.

In other words there might be I think it's called "Carriage return" data in there, so the row of data might be very deep (Instead of a row height of say 10.5 it could be anything, IE some could be 100 or 200 even).

There are unwanted characters, for example; ()[]{}+?!""^*

(If it could delete all unwanted characters except for letters/digits)
There is a problem I see, that if it removes _ or - between words, that it will join the words together which won't be of any use. If it deletes anything with a letter either side of it or a letter and digit, or 2 digits, 1 either side it would then need to add a space to replace the hyphen.

So for example; if there was a phrase in the list like ....

View 9 Replies View Related

Macro Formula To Clean Data In Large File?

Mar 3, 2014

I am trying to use excel tools to clean dirty data and compare the two cells. The information is there but tainted with additional information that is not relevant. I have tried to use Left/Right tools to capture alpha characters leading an address number with no real success. Also, when I get the data it seems to have some embedded breaks that I can't seem to get rid of that cause my tasks to error too.

View 4 Replies View Related

Vba Code To Extract And Clean Data Based On A Set String Ending

Dec 5, 2013

I would like to extract competition naps from the competition entries and then remove the string ending "nap" from the data so it can be pasted to another sheet in it's 'clean' format.

on the example sheet column B will always be the first column and the range will extend to either G,H or I (always the max range as there are always 6 to 8 races)

i would like the code to search through these columns of data and find the cell ending in 'nap' then to return this in column i, once done remove 'nap' ending from both the source cell and column i.

once done to then go through all the rows and do similar

the end result would be all naps returned into cell j and all the 'nap' endings through the data range B to I (max) to be removed to leave the horses name only.

in book 3 the first row nap was sommersturm so i have shown the outcome i would like with the nap ending in I1 removed and the horse name returned in J1 again minus 'nap' ending.

the data will always be clean with no leading/trailing/excessive spaces and always be lower case too. sometimes a space is not in between horse name and nap but it's always last 3 characters i want removed still.

View 4 Replies View Related

Inserting Timestamp On Data Sheet When Raw Data File Imported?

Feb 14, 2014

I have a workbook that requires refreshed source data each day. The workbook has all of the macros and formulas that analyze the data. I have the following code to import the worksheet with the raw data (onto a fresh worksheet in the calculation workbook), but I would like to create code that also adds the date and time to the imported data worksheet -- not the date/time the raw data was created; instead, when it was imported into my calculation workbook.

Below is my code for importing the raw data worksheet:

[Code] .....

View 2 Replies View Related

Macros To Clean, Summarize, And Merge Reaction Time Data Files

Jan 6, 2009

I need to use to prepare for analysis a large set of individual participants' Excel data files collected using a psychological reaction-time experiment (a modified Stroop task). This experiment was created using a program called Superlab by Cedrus, so I posted an inquiry at the Superlab forum [url]. Their tech support suggested I might need to use macros in Excel but couldn't offer further assistance. I'll try to briefly describe (a) our Stroop task, (b) the operations I'm trying to carry out, and (c) the format of the individual Excel files,

Our Stroop task: The participant gets some instructions and practice trials, then a series of stimulus words are presented one word at a time in the center of a computer monitor in one of several colors. Word presentation order is randomized for each participant. The participant must press a key corresponding to the color of each word as quickly as possible. For each keypress (including the spacebar, pressed on instructions screens), the reaction time (in msec) is recorded in their Excel spreadsheet under the 'Reaction Time' variable. The 'Error Code' variable indicates whether the participant pressed the correct (C) or incorrect (E) color key in each trial. There are 8 types of words for a total of 48 trials. (Actually, 4 sets of emotion words and 4 sets of control-animal words, each set composed of 6 words each. The task basically measures how much peoples’ attention is captured by emotionally relevant cues in the environment.)

For each participant's data, I need an efficient way (macros?) to:
(1) clean it [i.e. discard or ignore the instruction & practice trials as well as trials where the participant was too impulsive (reaction time < 100 msec), too distracted (rt > 3000 msec), or gave the wrong color response (Error Code= E)]
(2) determine whether enough valid trials remain for further analysis (>39 trials), and if so:
(3) calculate a mean reaction time score for each of the 8 word types [where denominator for each word type is based on # remaining (non-discarded) trials for that word type]
(4) merge each participant's summarized data as single rows in a common spreadsheet (for importation and further analyses in SPSS), like this:
---------------------------
ID#...... MeanRTW1.......MeanRTW2...... (etc. for word types 3-8)
101.......1056................2013...............
102.......2148................2594...............
103...
---------------------------

Excel File Format: I've attached a sample file, and here's a simplified overview of a spreadsheet (irrelevant columns and some rows removed). First the ID number is recorded (e.g., 393E), then some unnecessary junk (exp name & date, intro, practice, instructions), then data for the 48 actual trials of interest:
-------------------------------------------
........A...............B..................C.................D............
1 393E
2 stroop.xpt
3 Wed Jan 1, 12:33:00 2008
4
5
6 Trial Name.....Trial No..... Error Code.....ReactionTime
7 introduction..... 1................C............561243
8 practice.......... 2................C............... 2062
9 red-worried........14.............C................1001 (*the first practice trial)
10 (9 more practice trial rows, deleted here)
19 instructions........3..............C................5000
20 red-chicken......19..............E............... 1205
21 blue-tense.......32...............C.................782
* (46 more actual trial rows, deleted here)
--------------------------------------------------

To clarify:
-The variable 'Trial Name' indicates nominally what stimulus was presented for each trial.
-The variable 'Trial No.', indicates the unique numerical marker for each stimulus word. (It probably should have been labeled 'Word Type'. It doesn't reflect the order of stimulus presentation. E.g., the word "tense" is always 'Trial No.' 32 for all participants, regardless of when it presents.)
-A subset of actual trial words (e.g., worried) were also used for the 10 practice trials. Thus, the 10 practice trials must first somehow be discarded or flagged to be ignored before calculating average reaction times for the remaining 48 actual trials.

View 14 Replies View Related

UPDATING IMPORTED DATA

Jan 9, 2006

I am working with Microsoft Excel 2003. I am trying to import(or something
like it) from worksheet (A) to worksheet (B). Worksheet A is a spreadsheet
that I have saved to keep the same row names, etc. but the information within
the named cells is forever changing. I also save the information from
worksheet A, but have another copy that when I open, it always opens without
any changed data in it. MY question/problem is that I need to import the
data from A to B, and every time that A changes, I need B to automatically
update the data and continuously add to the spreadsheet I have made up for B.
I can NOT have A overwrite any data that I have already put into B.

View 13 Replies View Related

Imported Data Out Of Sync

Nov 7, 2006

I've imported a few thousand lines of data into excel, but some rows have a rogue character or a blank cell in the middle of them taking up a cell and shifting the rest of the row along one cell and putting it out of sync with the columns I want that data in.

Is there a way of remedying this without going through and manually moving a couple of hundred rows along one cell.

I'm not sure I've explained that particularly well, so I'll try and illustrate it with an example.

AAA 1.23 1.23 BBB 1.23 1.23 CCC 1.23 1.23
AAA 1.23 1.23 BBB 1.23 1.23 CCC 1.23 1.23
AAA 1.23 1.23 BBB ------ 1.23 1.23 CCC 1.23 1.23
AAA 1.23 1.23 BBB 1.23 1.23 CCC 1.23 1.23

Ignore the fact that they are all 1.23, I've just used that to make it quicker for me to show. As you can see row 3 has a ------ (representing a rogue character or blank cell) in the 5th column shifting columns 5-9 right one cell.

Now as I said I have a few thousand lines of data like this with maybe 2-3 hundred rows with this problem and I really don't want to manually go through and fix each one.

Is there a tool in excel or a way of using VB to fix this?

Alternatively, is there a way when importing the data to have a number of delimiters rather than the one extra one you can select to remove these on importing?

Maybe it could be fixed by taking any blank cell (or character) and deleting it whilst shifting all cells to the right of it one cell to the left?

View 9 Replies View Related

Trimming Data (imported From SQL)

Aug 11, 2008

I have import the database from SQL server, all the records imported begins with a blank space and they can not be trimmed using Trim function. Is there any smart solution ? I prefer to get VBA code to solve the problem.

View 9 Replies View Related

Extracting Part Of Imported Data

Mar 28, 2007

to extract a number from an imported cell containing text, a number and date. i need to use this number as part of a formula in another cell and the data needs to be refreshed every hour.

eg. the cell imported is "USD 30.97 (March 27, 2007)" and i need to use 30.97 in another cell.

i've tried using data - text to columns, but i realised that after splitting the cells, the 2nd and 3rd columns can't be refreshed.

View 14 Replies View Related

Imported Address Data In One Cell?

Jun 5, 2013

I have recently changed my software at my work from Sim-pro to Clik. I have about 4000 customer details that have been exported from Sim-pro to a CSV file but unfortunately some of the addresses are in one cell and need to be split up into 2 or 3 cell so it can be imported into Clik. In the Sim-pro program addresses are entered into one dialogue box e.g Address 1(house name - if applicable), Address 2(street name) & Address 3(suburb/area), after each line you press enter to separate them. The town/city, county and postcode do have their own entry box though and these do import normally into excel.

Unfortunately to import the addresses from the CSV file into Clik the Address parts 1,2 & 3 need to be in their own cells but obviously these are all in one cell(not every address have 3 parts some just use 1 address line which is fine). Can excel recognise the imported information from Sim-pro that is separated by 'enter' in that one cell and move them into another cell? I have tried using text to columns and selecting delimited and entering 'ALT 010' in the 'other' box but that doesn't work.I'm dreading the thought of going through 4000 addresses and cutting and pasting parts of the cells....

View 4 Replies View Related

Imported Data From Another Program To Excel

Jan 5, 2006

I imported data from another program to Excel, it is an address database. Some of the entries are all capital, some are all lowercase, some are proper. I would like to switch everything to proper. I have tried numberous times to do EXACTLY what I am reading about copy and pasting, entering the formula, designating the cells I want it to apply to. However, when I do it, nothing changes.

View 9 Replies View Related

How To Remove Space From Imported Data

Nov 20, 2011

I have exported a aging report from SAL to excel. Now the problem is each figures in the report is not in number format. when i checked each cell contains a space after the numbers so excel does not treat them as a number format.

how i can remove all the spaces in those cells. find and replace doeasnt work.

View 5 Replies View Related

Sorting Imported Data By Invoice

Sep 19, 2006

I have imported some files in to excel. I have attached the test document to give you an example of exactly what Im working with. Here is what I need to do.

1) On a separate worksheet I need to sort out the data by invoice number (Column E).

In the example I have on the worksheet titled "Main" I have listed what I would like it to look like. The purpose of this is that I don't want any spaces in rows. I just want a long list of invoice numbers and their information (Including the project number & customer on all rows). In long story short I want to erase all the information from A18:A25, and add project number and customer name to all the correlated invoice numbers. The way I think I can do this is that the first 4 digits of the invoice numbers are the same if their in the same project.

View 9 Replies View Related

Prevent Over Writing Of Imported Data

Sep 18, 2007

i want to import data from sheet2 a1 from sheet1 a1 continously. now problem is when iam importing i shouldnt loose my previous data. eg: at time 11 when i import data to sheet2 a1 from sheet1 a1 with value 9. and at time 12 when i import data to sheet2 a1 from sheet1 a1 with value 10. value 10 will be over wrting value 9. here i shouldnt loose value 9. i want values comming afterwards should come to next row.

View 3 Replies View Related

Scheduling. Imported QuickBooks Data

Oct 4, 2007

I have an excel spreadsheet that contains customer data exported from Quickbooks. In that file there is a column called CType (Column G) which contains the scheduling cycle for that customer. There are eleven different possible schedules, including 15xYr, 1xMo, 2xMo, EOM (every other month), EOW (every other week), EOW-S / 1xMo-W (every other week between 5/1 and 10/31 and once a month during the rest of the year), EOW-Th (every other week but must be on a Thursday), ETW (every third week), On Call, W, Q.

Although the number of records changes daily, on average there are about 950 rows of data in the spreadsheet.

I need to set up an array (?) for the values in column G starting with G2 through the last non-blank row (all records will have data in column G), and calculate the next scheduled service date based on the schedule type shown in column G and the last service date which will appear in column M of that row. The last thing I need to consider is whether there is a value in Column N, which would represent a hard-entered ‘Next Scheduled Service Date’. If I find a date in that column it needs to over-ride the calculated value. My assumption to this point is that I should use a new column T to hold the value of the calculated schedule date. There are a few other details, but rather than confuse this whole thing further I’ll stop there.

What I’m struggling with is the most efficient means of running this macro. I’ve been looking at many, many threads over the past few weeks, reading
VBA Programming for Dummies (which I apparently am), and reviewing other resources.

View 3 Replies View Related

Match Data To Imported Data For Comparison

Jun 27, 2008

I want to be able to do, however. I want to make a spreadsheet that has all the equipment items preloaded into it, along with the quantity that we're supposed to have of said equipment. Then, I would like to import the data from the text file, having it match items in the spreadsheet to their equivalent in the imported text file, and then bring in the quantity scanned. That way, I can use some conditional formatting to show when there is a miss match between "Required" and "On-Hand" quantities.

What I don't know how to do, is get Excel to only import the name of the item, and the quantity scanned, instead of all of the information that the scanner spits out. Also, I don't know how to make it match the name, with the one preloaded into the spreadsheet, so that the correct quantities are matched up. Here's an example of what the scanner spits out: FIELD WIRE,6145-01-155-4256,[Scanned Quantity Goes Here],N/A,N/A,RESPONSE TRAILER,,

The scanner creates records like this the first time you scan an item. So if you scan Field Wire first, it's the first record. However, if you scan it fourth, it's the fourth record. How do I make that match up with a predesigned spreadsheet?

View 2 Replies View Related

Search Not Working After Data Imported From Database

Aug 21, 2012

Have the following code:

With iSheet
i = .Range("A" & Rows.Count).End(xlUp).Row
j = .Cells(1, Columns.Count).End(xlToLeft).Column

.Range("A1", .Cells(i, j)).ClearContents

[Code] .......

If I use F9 to pause the code before the sort part in blue, then the data imports into Excel from the database and then subsequently pressing F5 sorts the data as required.

However, if I run the macro in a single pass, the data does not sort. Why it's not sorting as expected and how to make it sort as required?

View 1 Replies View Related

Converting Imported Data To A Date Format

May 1, 2002

I am importing data from my AS400 in Excel, the dates are coming into the spreadsheet as numerics. How do I convert these numbers into a date format? i.e. 3202002 should be 3/20/2002, how do I get the number to that format?

View 9 Replies View Related

VBA To Sort And Consolidate Similar Items From Imported Data

Sep 6, 2013

We have a software program that we use to takeoff HVAC equipment on drawings. It will export all of the items to an Excel worksheet. Once it is into Excel I need to sort the data by two or more different columns, then sum three to four columns for each unique item for transfer to the equipment sheet for pricing. I've searched this site and others, but have not found a way to do this with VBA in Excel.

Floor
Rank
Name
Description
Qty
Cost
Labor
Seismic

[Code]....

The sheet is a simplistic view of what I'm trying to explain, obviously in high rise there will be many floors and hundreds of items. The actual spreadsheet has approx 12 columns, but only 3 or 4 need to be summed per similar item. Most times I sort by Range & Name. On occassionwe need to sort by Floor, Range & Name. Used to do this with a Database & RR Report Writer, but the new software does it onscreen with digitized drawings.

View 2 Replies View Related

Error When Updating Chart From Imported File Data

Oct 4, 2013

I've created a spreadsheet which, on running a macro, imports data from a text file, formats it and then sums various parts of it giving me a subset of the large file as a range of data for a chart (a pie chart) on Sheet 2.

The problem begins when I delete the data in the worksheet in preparation for another import - the Pie chart just loses all the data and I have to manually reselect it in the chart each time.

Once deleted the chart is blank, but as soon as the data is imported, I get reference errors when I click on Sheet 2

I must be doing something wrong. You can delete data and repopulate it and the chart should pick up with the new data. If the cells it is referencing are empty, it is blank. Not so here.

Is it to do with importing the data? Or the formula for my chart data?

View 1 Replies View Related

Functions On Imported Data That Can Change Location In Table

Feb 7, 2007

I am trying to achieve can not be based on a range of rows or cells it must as this data is imported from a forecasting application and the location of the targets may change.

Perhaps an offset to the current selection can be used some how, but have a look-see if you know where Im coming from.

'I have used this to find a target in a data range.

Dim r1 As range

Public Sub FindDataIn Range(r As Range, target As Variant)

Set r1 = r.Find(target)
If r1 Is Nothing then
Msg Box target & " was not found"
Else
r1.Select
End If
End Sub

'Then I inserted and Named this procedure to find the data on various assumptions or targets - SUCH AS THE VALUE "14306".

FindDataInRange ActiveSheet.Range (A1:A226), "14306"
Selection.EntireRow.Select
Selection.Copy
Selection.Insert Shift:=x1Down
Selection.EntireRow.ClearContents

Then I write this again for another Target such as 14307 and it repeats

The result is that it finds the target cell I get an empty row above the two rows that contain that target. (LET ME EXPLAIN WHAT I MEAN BY TWO ROWS)

The thing is there are two rows containing 14306 in that range and the range is sorted ascending so that they are positioned one under the other. Each row has different forecast totals beside this number because one is an export SKU and one is a Domestic.

What I want to do is combine the two rows as one with one row of forecast totals for the number rather than two.

Like this:
14306big Widget Domestic 26 89 (This is combined as a new row)

Instead of this:
14306big Widget Export 12 14 (These 2 rows are then deleted)
14306big Widget Domestic 14 75

Also the Forecast totals run across 12 columns (one for each month) and then there is a column for year totals of each row that needs to remain the same.

Most important this here is this cannot be based on a range it must as this data is imported from a forecasting application and the location of the targets may change.

View 9 Replies View Related

Entering Formula- Data Imported From Access And Saved As A Worksheet

Dec 7, 2007

I have a workbook with just one worksheet. It's just a list of data imported from Access and saved as a worksheet. When I try to enter a formula ie '=4+4' it goes in as text and will not calculate. I have tried various formatting to no avail. I added a second worksheet to see what happens and this works fine. (XP home, Excel 2003).

View 12 Replies View Related

String Length Too Long For Single Cell On Imported Data

Sep 13, 2013

I have a google earth KML file that I have converted to text, and through a bunch of manipulation have been able to pull a series of GPS coordinate strings into a single cell string. Unfortunately, the string data is beyond what excel 2007 can handle for a single cell. so my thought is to have excel pull each coordinate string into a separate cell with which i can then run a macro to develop a new KML dynamically. (changing multiple attributes based on a query to a database)

Each string of coords actually maps out a single region (path) on the KML, truth be told it is telecom rate center data, and each rate center will have numerous other variables applied to it depending on my company's voice network capability for a given rate center. Currently my only desire is to depict differently any rate centers that I'm able to deliver VOIP services to by showing them in a different color...but these change very often so it will support to be able to auto generate the map from time to time.

the raw data from the KML looks like this:

Code:

CLINTONVL

RATE_CNTRCLINTONVL
STATEPA]]>

ff000000
1
0
1

[Code] ..........

After doing my data import, i extracted via various manipulations, the rate center name (a common lookup value that stays constant across multiple databases), and the string of coordinates. this is where i run into trouble. i need to pull each coord into a separate cell assuming i won't run out of cells in the x coordinates to gather this data OR find a way to grab the data via another lookup to another document...not desireable.

I want my output to look like:

Code:
RC_NAMECOORDSLATAVoip?
ALIQUIPPA
80.334114,40.520974,0-80.327493,40.520023,0-80.323915,40.51957,0-80.31997800000001,
40.519933,0-80.316958,40.521221,0-80.314431,40.521445,0-80.314262,40.521332,0-80.31398,
40.521194,0-80.31315600000001,40.520832,0-80.313057,40.520794,0-80.312805,40.520641,

[Code] ........

First off, my import was jacked up by missing some comma's...this i can fix easily with the string importation and manipulation HOWEVER...i still run into the issue of string length OFTEN.

View 1 Replies View Related

VBA Code To Import Text Files & Process Imported Data

Jul 26, 2009

I have two macros one of which imports the data and the other processes the data. These macros were created at different times and need to be joined into a single macro that will combine their operations – with slight modification to the importing macro. Let me describe what each of the macros does:

PROCESS macro:
Cycles through the CONTROL CELL on the “1” tab using the VALUES TO TEST. For each value to test it copies the values form the output tabs and pastes them into the A+B tab. Then it removes the duplicate rows there.

Option Explicit
'======================================
Sub PROCESS() 'This subroutine is called when clicking on the first button
Dim i As Long, j As Long, k As Long 'Those are the variables that will browse through the whole sheets
Dim l As Integer 'this will be used to browse through the values to test
Dim TheSearch(1 To 2) As Object 'This is an array of objects that will be used for the search
Dim TheRange As Range 'This will be used to flag the range of duplicates in the output

'Searching for the Text string 'VALUES To TEST' in the sheet "1" in order to know where the array of values to be tested start
Set TheSearch(1) = Range(Cells(1, 1), Cells(ActiveSheet.UsedRange.Rows.Count + 10, ActiveSheet.UsedRange.Columns.Count)).Find(What:="VALUES TO TEST", LookIn:=xlValues, Lookat:=xlWhole)

View 9 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved