Macro To Split One File Into Many Based On Criteria

May 16, 2011

I have a file, with this dummy data

Fruit Country QTy
Apple India 100
Apple USA 200
Orange India 150
Grapes Aus 100
Grapes India 100

I need to macro, wherby it will create 3 files namely apple, orange,grapes and store the relevant rows.

Hence I need a macro to split file into different files based on different values in a column and accordingly name it .

View 9 Replies


ADVERTISEMENT

Macro To Split Excel File Into Separate Workbooks And Automatically Email It

Jan 10, 2014

I need to write a macro to split an excel file into separate workbooks and automatically email our project managers.

View 1 Replies View Related

Macro To Split And Remove Based On Cell Value

Apr 18, 2014

This is my input:

Col A
asde,dsfts-qwsa/001,asdasd-qwsa,asdas
etert,ttyutt-tww/013,dgdd-tww,dsfsaa
.
.
.
.
.

Col B
qwsa
tww

In Col C.. I want the output to be as
asde,asdas
etert,dsfsaa

Requirement as a text:

I need a macro that removes the value in column A based on the value in Col B.

The data that the macro removes is always between the "," (comma).

View 6 Replies View Related

Macro To Split Table Of RawData Into Individual Worksheets Based On Column C Value?

Jun 19, 2014

I am trying to divide a table of data (7 Columns, 500-1000'ish rows) into individual worksheets based on any unique values in column. There may be anywhere from 10-30 instances of the same value in Column C, and I need to bring all rows of each unique instance into a newly created worksheet to be labelled the same as the value in Column C.

The RAW data will be updated monthly by keeping a template file copying and pasting data, therefore I am hoping to have a "SORT" button with this Macro assigned to it. I have quickly thrown together a sample workbook with how the RAW DATA will be pasted into the file, with additional sheets showing how I would like the data split and organised.

View 2 Replies View Related

Macro To Download Csv File From A Dynamic Date Based Url To A File Location

Feb 23, 2014

I have a requirement to download a lot of historical data files from the archieve of an website. The url goes something like this: [URL]....

This downloads file for 21022014 ie. 21-Feb-2014. I need to be able to have a facility to have a selection criteria on my user form (in excel) where I specify a date range and the macro automatically downloads all the valid excel files available within that date range (files for Saturday, Sunday and some holiday dates will not be available in the website archive database) one after the other (like at single clcik of button) into a specific location (predefined viz.. c:/Users/EOD files/) on my laptop. Best would be if I am able to select the save location run time by using a 'Browse' like feature where I go and choose my local laptop folder...same type when we try uploading a file from our laptop to the web..

View 1 Replies View Related

Open File Based Cells Criteria?

Jun 29, 2014

How to open files based criteria in cells value?

[Code] .....

View 5 Replies View Related

Split File Name From File Path

Feb 16, 2008

Each month I am sent a spreadsheet which contains a list of 100's of different file paths (including file name).

For example (Quater 1 is the document name)
R:ManagementJohn2008SalesSectionAQuater1

I would like to remove the file name from the file path (I will then convert the file paths to hyperlinks which will open the folder the document is stored in but not the document itself.

For example
R:ManagementJohn2008SalesSectionA

View 9 Replies View Related

Split File

Dec 15, 2008

QB03654338AGLQLD210/06/2007 0:0014/02/2008 0:00
QB03654338AGLQLD215/02/2008 0:0010/04/2008 0:00
QB03654338AGLQLD219/08/2008 0:0031/12/9999 0:00

to this:

QB03654338AGLQLD210/06/2007 0:0014/02/2008 0:0015/02/2008 0:0010/04/2008 0:0019/08/2008 0:0031/12/9999 0:00

So adding it to all to one line if it is the same ID number "QB03654338". See the attached file.

View 2 Replies View Related

Split CSV File Into Rows?

Feb 14, 2014

A have a CSV file which contains a string of data that has a repeating pattern e.g

1234561234560N12343159753 00Company 123 Mr Smith 9874561236540N12343159753 00Company 432 Mr Jones 654987159753680N12343159753 00Company 431 Mrs A Bruce

The first long string of numbers are bank details (Sort Code, Account Number) followed by our company bank details then company name, then a reference number then the name of the account holder.

There are over 20000 records all in one long string of text and all contained within cell A1. There are also a few occasions when there is no space between the name of the account holder and the start of the next persons bank details.

What I need is for there to be a split after each account holder's name and for each persons details to be on a new row e.g

1234561234560N12343159753 00Company 123 Mr Smith
9874561236540N12343159753 00Company 432 Mr Jones
6549871597530N12343159753 00Company 431 Mrs A Bruce

Ideally I would also like the first string of information to be split in to columns so that it reads as so -

123456 123456 0N12343 159753 00Company 123 Mr Smith
987456 123654 0N12343 159753 00Company 432 Mr Jones
654987 159753 0N12343 159753 00Company 431 Mrs A Bruce

The first collumn would contain the first 6 digits, the 2nd would always contain the next 8 etc. I have tried using the Text to Columns function but it gives me seperate columns for initals etc when I would like the full name and title in one column.

View 5 Replies View Related

Macro To Sum Data Based On Criteria

Aug 17, 2012

I have a data which i need to total based on document types.

Document types in cells are AB=CELL A1, ZR=CELLL A2, ZP=CELL A3,
SK= CELL A4.And amounts in rows 555=CELL A1, 625 = CELL A2,
725= CELL A3, 925=CELL A4 and so on.

My challenge is to get all the total of ZR,SK,AB type of documents using macro.Initially i used this formula, however now document types are more than one.

=SUMIF([Book1]Sheet1!$C$2:$D$4,"zr",[Book1]Sheet1!$D$2:$D$4)

View 6 Replies View Related

Macro To Count Based On Criteria

Sep 11, 2006

I have ahseet with the following columns:

Col 1 = Item Description
Col2 = Price
Col3 = Discount Rate

I would like to gather a count on another sheet of all instances in col 1 where it is equal to 'Fridge' I know I can use the SUMIF function but I would like to do it in VBA code.

View 5 Replies View Related

Split TXT File To Word Documents

Mar 31, 2012

Below code is for splliting text file into multiple excel worksheet. I want to modify it to splitting text file into different msword documents in folder. Is it possible to change the code

Sub LargeFileImport()

'Dimension Variables
Dim ResultStr As String
Dim FileName As String
Dim FileNum As Integer
Dim Counter As Double
'Ask User for File's Name
FileName = InputBox("Please enter the Text File's name, e.g. test.txt")

[Code] ........

View 3 Replies View Related

Split Range Data For CSV File

Jun 5, 2008

I've got an Excel document that is generated from a third party programme (See ExcelDoc attached)

I'm trying to manipulate it so that a macro creates a CSV file like the one attached (see THK.csv)

I need to have the following columns in the CSV file populated using the Excel spreadsheet

Column A: Will need to have the NUMBER that is in cell B2 of the Excel file in this case the number is 0714 (need to keep the preceeding 0 too)

Column B: Will need the phone number
Column C: Will need the fax number
Column D: Will need to have the email address
Column E: Will need to have the date only
Column F: Will need to have the Order Number
Column G: Will need to have the Customer name
Column H: Will need to have the Customer telephone number
Column I: Will need to have the Customer alternative telephone number
**Column J: Will need to have the 1st line of the address (after First Address in xls doc)

I've managed to get a macro that will take the information and transpose it into a new document and rename it as an CSV file but I am having a lot of problems trying to get the macro to create the CSV file in the format that I need (see following macro)

Sub CreateCSV1()

Dim wbMyBook As Workbook, iAddPos As Integer

Application. ScreenUpdating = False
Range("B2:B11").Copy
Workbooks.Add
Range("A1").PasteSpecial (xlPasteValues), Transpose:=True
Range("A1") = Left(Range("A1"), InStr(Range("A1"), " ="))
iAddPos = InStr(Range("J1"), "TEGKON:")

I've attached the xls document (the one that is generated and the CSV file which is the format I'm trying to achieve.)

**This cell is generated and will have commas at the end of each line of the address and will be terminated by a period (at line 4 of the address. Sometimes there will be 4 lines to an address but sometimes there may only be 2 or three. In the case where there is no information I need to have a blank ( null) value in the cell

View 4 Replies View Related

Macro To Fetch Data Based On 2 Criteria?

Oct 22, 2013

Attached is my .xls with dummy data Fetch data By Director.xlsx.

My intention is that once the Director and Month in tab 'By Director & Month' is chosen and the Fetch Data commandbutton is clicked, a new workbook should open.

This new work book should have :

all entries in tab 'Monthly Invoice Input' for that Director-Month combination,along with a sum total of column Q(Total invoice amount) in the last row.

View 6 Replies View Related

Macro To Delete A Range Based On Certain Criteria

Jan 22, 2009

I have a table of data with which I need a macro to clear a range of data based on certain criteria. I have attached a file as an example. In this example the current period is 6. I therefore need to clear columns which have a period of 7 or higher.

Essentially, if the current period is x, then clear the range in the period columns if the period is greater than x.

View 6 Replies View Related

Insert Row Macro Based On Cell Criteria

Jan 29, 2009

I'm trying to create a macro that takes data from one row and inserts it into a new row. Attached is a workbook with a before and after example of what I'm trying to do.

Each row has a security transaction that includes principal cash and interest. The data needs to be formatted so that each transaction has one row for principal and one row for interest.

Principal is identified by the tran code PAYDOWN in column C. Interest is identified by the tran code INT. However, the raw data generated includes both interest and principal under the tran code PAYDOWN.

There could be 100 or 1000 transactions generated based on the day.

View 2 Replies View Related

Macro To Move Cell Down A Row Based On Criteria

Feb 20, 2009

I would like a simple macro that would actually move a cell based on criteria. In my case it would be: In row A, if a cell starts with 'Agent Name' then that cell needs to move down one cell replacing the contents of that cell.

View 3 Replies View Related

Macro To Color Cells Based On Criteria

Jul 27, 2009

Column DColumn EColumn FTarget %DifferenceCash4%5.12%Large-Cap8.5%1.73%Commodities4%-1%

I need to color code Col F based on the following criteria:

If F2/E2>20%, then shade pink else no color. I only care about the absolute values. The 20% number can change depending on the category. So for commodities, the limitation is 30%. Like that I have a list of about 20 asset classes, 14 of which have the 20% constraint, rest are either 25% or 30%. I would like the cell color to be updated each time I import a file. Also I have other conditional formatting on Col F (like red color if negative number) so I don't know if another conditional format will work on the same cells?

View 9 Replies View Related

Split Excel File Into 5 Smaller Files

Dec 17, 2013

I have an excel spreadsheet that has over 10 thousand rows and is 40+ Mb in size. It is giving me timeout errors when trying to import it into Joomla 2.5. Therefore, I need a way that I can easily split the file into 5 smaller files. Here are the column headers: titlemetadescmetakeyaliascategory_pathstateintrotextaccess

I tried doing it manually but is said the cell sizes were different...

View 3 Replies View Related

Import CSV Into Worksheet Split Into Columns Then Copy Rows By Criteria

May 26, 2009

I have requirement to extact data into a spreadsheet. This data is extracted from CSV file which is huge normally over 7MB. I have found a macro on the internet which I have included with this post.

Sub split()
Dim ResultStr As String
Dim FileName As String
Dim FileNum As Integer
Dim Counter As Double
'Ask User for File's Name
FileName = InputBox("Please enter the Text File's name, e.g. test.txt")
'Check for no entry
If FileName = "" Then End
'Get Next Available File Handle Number
FileNum = FreeFile()
'Open Text File For Input
Open FileName For Input As #FileNum .................

I have also included reult data that I get after running the macro. I have cut down on data due to attachement restrictions. But usually there are multiple spreadsheets named "Sheet1, Sheet2, Sheet3 and so on". I have numerous requirements. First of all I want to be able to spreate data into columns. For now how I do that is by going to data -> text to columns and then selcting delmited and then selecting comma as my delimiter. Second thing I want to do is is only extract range of data from this output into a new worksheet. I am only interest in the name like for example ALBANY-Serial0/0/0 and data that is in the range of 8:00 AM to 6:00PM. So the new sheet should only have name and for that name data in the range of 8:00AM to 6:00PM for all the sheets "sheet1, sheet2 etc" until all data has been extracted.

View 7 Replies View Related

Macro To Delete Rows Based On Multiple Criteria?

Jul 10, 2014

A macro is required to identify rows within a selection e.g. entire column A, that share the same value, then delete appropriate rows depending on the values in another column. The attached example details the requirements.

Extract Rec1.xlsx

View 6 Replies View Related

Macro To Copy Data To Other Sheet Based On Criteria...

Feb 19, 2009

We're working with a large workbook with data from A5:P20000 on sheet1.

I need to be able to pull data from sheet1 to sheet2 based on the invoice number in column A on sheet2.

Sheet2 will have different invoice numbers in column A, some of these invoices numbers are in column H on sheet1. I need excel to find these invoice numbers and copy the data from that row on sheet2 to the row with that invoice number on column2.

Example:
Sheet2 A5 has invoice number 1234457
This same invoice number is located on sheet1 H3400
Need to copy to sheet2 (starting in cell B5) the following cells from sheet1 (B3400, C3400, E3400, G3400, H3400, I3400, J3400, K3400, M3400, N3400).

View 15 Replies View Related

Macro To Delete Rows Based On Multiple Criteria

Apr 9, 2009

I need a macro to delete old data from a large selection of data, in order to keep the size down.

What I want this macro to do is

Check all rows from 5 downwards.

If A5 (date) is less than cell $B$1 AND B5 is not equal to C5 then delete the whole row.

Continue until reaching the bottom.

View 9 Replies View Related

Macro: Copy Data Based On Criteria/Condition

Oct 16, 2006

Attach is a sample of my project. I have to loop through B9:B80 in sheet("Raw Data") and capture the value of each cell. EG:

* if Value captured is 120A --> check with sheet("SP14F") from the row which contains the same value.

* i have to check that the aperture, outer and inner values of Layer 120A and so on..of the Raw Data sheet is the same as that of in the SP14F sheet.

* if the values are not the same, change the font to red

i understand that this task requires looping and arrays.

View 4 Replies View Related

Macro: Count Data In Range Based On Criteria

Nov 10, 2006

I have a list of several ranges defined in vba, and i am trying to find which range a cell containing word is in excel. Im am looking for help for a good way of doing this.
For an example: Say I have 2 ranges defined, the first range corresponds to column A, the second to column B (just an example). The word "Dog" is written in cell B15. I want to find out in vba what range "Dog" is in. I would like some vba code to check and find either if it in a given range (boolean) or a way of checking a list of ranges and returning which it is in. The word will only appear once on the spreadsheet. I have played around with the find command (A=range.find(Pl), then check if A exists) but i havent had any luck (I get an 'Object variable or With block variable not set) I tried searching for a while, but was having trouble finding something related to what i am trying to do.

View 7 Replies View Related

Split Large File Into Multiple Smaller Files

Dec 12, 2009

On this forum, a script is provided to break a large Excel file into smaller 500-line files:

Split Worksheet Into Multiple Files By Every Nth Row

I copied the code and pasted it into the VBA editor in Excel 2007, but when I run the macro, it generates an error message:
Runtime error 91: Object variable or With block variable not set.

The line the debugger identifies as the one with the error is this one:
For lLoop = 1 To rLastCell.Row Step 500

Here is the full code from the previous thread: ...

View 9 Replies View Related

Macro To Select Multiple Files And Copy Them Based On Criteria?

Mar 10, 2013

This is what I am trying to achieve:

1) Prompt user to select a file (or multiple files)

2) Copy the files that meet certain criteria to a folder

My attempt (fail):
VB:

Sub FILES2SFTP() Dim FileNames As Variant Dim I As Integer Dim fso As Variant Dim Data As String ChDrive "G:" ChDir "G:TEST" Data = InputBox("Enter the date", "Enter the date", Format(Application.WorksheetFunction.WorkDay(Date, -1), "yyyymmdd")) Set fso = [code]....
I get error 424 object not found in this line:

If fso.getfilename(FileNames(I).Name) = ("Name1" & Data & ".xls" Or "Name2" & Data & ".xls") Then

View 3 Replies View Related

Excel Macro / VBA That Will Hide Rows Based On Multiple Criteria

May 23, 2012

I would like to hide rows for data that does not meet specific criteria. For example: If a user selects room number 101 from a drop down in B1, I want to filter data in range A3:F1000 to show me only room 101 rows (A column) where C column contains a value larger than zero OR D column contains a value larger than zero OR E column contains a value larger than zero. I do not want it to return rows where 101 may be in other columns beside A.

Sample:

A B C D E F
__________________________________
1 ROOM: 101
2
3
4 101 XX 1.2 0 0 P
16 101 YA 0 0 1.1 L
23 101 JJ 3.2 2.1 0 L
55 101 JJ 0 0 1 P

So, if a row contains 101 in column A and all three values in columns C, D, and E equal 0, then those rows will be hidden.

View 8 Replies View Related

Macro To Compare 2 Lists Based On Multiple Criteria Using SUMPRODUCT?

Feb 27, 2014

I want to compare 2 lists in separate sheets based on multiple criteria and delete the duplicates

Sheet 1 - new list in column A:E
Sheet 2 - old list in columns B:F

So here is what I need: the macro should generate single IDs made of Sheet 1 Ai,Bi,Ci,Di,Ei cells for each row i to the end of the list + generate single IDs made of Sheet 2 Bi,Ci,Di,Fi

If . Evaluate (Sumproduct (IDs made of Ai,Bi,Ci,Di,Ei from sheet1) & Sumproduct IDs made of Bi,Ci,Di,Ei,Fi from sheet2) >1 then delete the entire row in Sheet 2.

This will leave me with only updated items (rows) in Sheet 2

View 1 Replies View Related

Counting Macro Based On 2 Criteria (Horse-racing Spreadsheet)

Jun 21, 2006

Horses have 5 running styles; early speed to late closers; denoted as 1 to 5 in column Z. I'd like to count those noted as 1 thru 3 for each race.

In column FC (the last column with data) I have a race ID # for each race on the spreadsheet, somewhere between 2500 to 5000 races in each one. They're a monthly record. The race ID # is a concatenation of columns B (Track ID), C ( Date) & D (race #). Each is unique to its race. E.G. Aqueduct, jan 1st, 2004, 2nd race is id'd as AQU379872.

Would it be possible to create a macro that would (A) count the number of horse 1s, horse 2s & horse 3s from a specific race ID & then post those numbers in columns FD thru FF & (B) then continue to the next race ID in column FC & count those horses from that race & so on thru the entire spreadsheet?

Would it be simpler if each race ID were changed to a number--race 1 down to race 2500?

View 9 Replies View Related







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