I have a file that gives some statistical data to my co-workers every 15 minutes. A common question I get is "How does that compare to last week?" Then I have to open the file from 7 days ago, find the data from the same time interval, and subtract it from this week's number in my head. I'd like to have excel do this for me.
I know how to get data from an external file. The problem is, these files are named with a date on the end of the file name. So tomorrow, the static formula won't work anymore (or rather, it will give data for a file from 8 days ago, instead of 7). I'd like to excel to use today's date, find the file from 7 days ago, and get the data from that file to compare to the current file.
Here's what I've done so far:
Code: ThisDate = Range("C1").Value 'the cell with todays date in it ThisDateName = Format$(ThisDate, "yyyy-mm-dd") 'now formatted the way I need it ThisDate7 = Range("G1").Value 'the cell with the date 7 days ago ThisDateName7 = Format$(ThisDate, "yyyy-mm-dd") 'formatted correctly ThisDate14 = Range("G2").Value 'the cell with the date 14 days ago ThisDateName14 = Format$(ThisDate, "yyyy-mm-dd") 'you know, in case of a holiday 7 days ago
I have no clue what to do next. I want Excel to: Use "ThisDateName7" to find the file with the name "pph_tracker_[ThisDateName7].xlsm"Get data from a cell in that file (say, C15)Subtract it from the data in the same cell (C15) in today's file (this week - last week)Give me the result in today's file (say in cell C20)Do that again for cells D15, E15, and so on (result in D20, E20, etc)
I assume I can figure out the rest from there. Can I use the variable names in an actual formula in cell C20? Something like:
=C15 - '[pph_tracker_{ThisDateName7}.xlsm]Sheet1'!C15 or even =C15 - '[pph_tracker_{The Date in Cell $G$1}.xlsm]Sheet1'!C15 which would require no macros at all!
I have a set of data with 5 columns. The first column is ID. Now I have the same ID recorded several times with different data (in the other 4 columns) against the ID. I want to concatenate the data with the same ID into the same row. The data has already been sorted by ID. If it is the first time this ID appears, record the whole 5 columns. If the ID appears again, then record only the 3rd, 4th and 5th column. When I run my code, I got error 'subscript out of range (Error 9)' . It seems that the array I use has only 5 columns. But I don't know how to modify this.
VB: Sub Patient_Detail() Dim n As Integer 'index of rows to record to Dim i As Integer 'index of column to record from
how can you combine all data from different workbooks in to one workbook. i have 544 workbooks to combine. here is a sample screenshot of the table i need to combine.
it consists of 9 columns. rows are not consistent in number and sheets are named with numbers starting from 001 to 999 ....
I am building a rather good size userform. It is getting really lengthy code-wise because I want certain things to be enabled and disabled on the form as they click on certain options.
I know I can hard code the lines but so I am trying to come up with some coding elements where I will not have to add 20+ lines of code for everytime I want to add a new feature.
Here is one of the functions that I have, There is going to be several of these:
Private Sub chkMore2_Click() If chkMore2 = True Then cboProtocol2.BackStyle = fmBackStyleOpaque cboApplication2.BackStyle = fmBackStyleOpaque txtLowPort2.BackStyle = fmBackStyleOpaque [Code] .......
So If I click chkMore2 ... all of the 2nd elements will be editable. If I click chkMore3 ... then all of the 3rd elements will be editable, etc. etc.
So I tried to play with this code example:
Private Sub CheckBox1_Click() If CheckBox1 = True Then Call Changeit(1, "yes") Else Call Changeit(1, "no")
[Code] ........
Excel 2007 does not like the .concatenate element.
I have a spreadsheet, in which I need to lookup invoice numbers from a raw data file with ~5,000 line items on a daily basis. The lookup is based on two criteria searches (1) search product type (2) search product make. In this example, I have 4 product types:
1 – car 2 – truck 3 – boat 4 – motorcycle
For this example I want to search invoices; (1) first search for cars only (2) search for product make. In my attached example, the first item (cell E2) would return invoice number 7147875-FRD from the raw data file. The second item (cell E3) would return invoice number 7147877-NSN.
I want to track daily sales of a shop with the tenders (Cash, Master, Visa)seperated.
Everyday there will be a file ctp.dbf from a folder YYYYMMDD (previous day date) which contains sales details.
I tried to use sumif commands and everything is working fine. everytime i have to open book.xls and from it I do a files>Open to open the ctp.dbf for the calculation to be done. is there a way where by i can open 1 file and everthing i calculated properly?
Also this book.xls can only do for 1 day how can i go about having the daily sales detail of the month (look something like sales summary.xls) or even year in 1 excel file?
attached is book.xls and sales summary.xls for reference.
I would like to automatically update a 'yearly' database file with info from a file that is changed on a daily basis.
The daily file that i use has info like date, truck number, delivery stops, weight.
the database file has the similar headings.
at the end of each day this daily file is saved. I would like to have the info that is entered into the daily file automatically plugged into the yearly database file into the next available group of cells with respect to the salesperson.
This is kind of a generalization but i'm hoping to just get pointed in the right direction. If something like this involves vba then it will be beyond my ability and i'll have to do it manually, which is fine
I want to combine each row in column A that contains data (so stop process when the next cell is blank) into one single cell. However, each time a row is added I want it to have a new line, except for the last one. I don't know vba that well. I came up with something.
Basically I want to do this: =A1&char(10)&A2 VBA Dim i As Integer i = 0 Do While Not IsEmpty(ActiveCell.Offset(0, -1)) If (i = 0) Then ActiveCell.FormulaR1C1 = "=RC[-1]" i = i + 1 Else ActiveCell.FormulaR1C1 = "&CHAR(10)&R[i]C[-1]" i = i + 1 End If Loop
I have thousands of Excel files, each with a generic names (i.e. 2009092812163503.xls)
Each of them contain a header with contains column titles like Company Name, Executive Contact, Address, etc and then a single row of data for a single company.
I want to be able to task excel to extract all the data in the second line and enter them all into a single spreadsheet for further work.
We're talking 30,000+ unique files here, what would be the best way to approach this?
I'm trying to collect specific data from a collection of different (.xls) files into 1 master file using the following code (which runs in the master file):
Code: Sub FolderPick() Set fso = CreateObject("Scripting.FileSystemObject") With Application.FileDialog(msoFileDialogFolderPicker)
[Code].....
I'm having trouble with the Name-variable in the 'red line'. This variable is set in the 'purple lines' however, the code (which I got online) keeps adding ".pdf" to the name.
I think it has to do with the settings of the 'purple/underlined line' but I don't know if this is true and if so, how to change it.
I would need only the first row data to be copied into a master file in column A (row A from each file to column A, column B.... etc - basically transpose value into master file)
I'm a relatively competent VBA user to a macro recorder and basic editing of custom code level but fall short with writing custom code and don't have much used or proven code I can copy from.
Problem: I'd like to automate a process whereby consolidating certain information within many data files (possibly up to 500) into a single tab within a master file.
At the moment there are only a few data files which are manually consolidated by way of manual links but going forward it will increase significantly, hence the need to automate.
I need to consolidate the following 5 cells from each data file A1, A2, A5, A7, A8 (vertical) into a single row within the master file across 5 columns (horizontal), i.e. each data file will populate 1 row in the master file, one below the other. If there are 500 data files there will be 500 rows of data in the master file.
The data files will be saved in a central location on our server and the master file will sit outside this folder, possibly in a subfolder.
Something which would be handy is a link in the master file to each data file, i.e. if I click on a data row in the master file it would jump to the source data file.
I have a column of data that will vary in length and I'm trying to write a macro to combine it all into one cell. Basically I need to do the equivalent of entering "=A1&A2&A3..." for the entire column. I started by creating an array string variable and have the data in grp() but now I'm stuck trying to figure out some sort of loop to keep adding onto the same cell or something
I want to combine both an 'if' and a 'vlookup' within a single cell. So I want to say if the value in cell a1 can be found in columns c1:d100 then return a 'yes' if not return a 'no'. How do I do this
I have an master excel file with 20 sheets with names x,y,z,a,b,c,f,.... Each and every sheet has data which start from Row 7 and Column 2. Now i need to consolidate this data in one sheet in another excel file.
Consolidation should be like
Suppose X sheet has 20 rows and 4 columns of data which starts from Row 7 and Column 2, this data has to be copied and pasted in my new excel file copied on my desktop. Now first 20 rows are occupied in new excel file.
Now code should move on to master excel file Sheet Y which has 45 rows and 4 columns of data which starts from Row 7 and Column 2,this data has to be copied and pasted in my new excel file from row 21, which means Master excel file sheets has to be clubbed to one consolidated excel file.
In All the sheets in Master file Data starts from Row 7 and column 2.
Data range varies row wise in each sheet but column length is fixed to 4.
I am doing financial ratio analysis of a company for five years and I need to show the ratios in a trendline. I have generated seperate line charts for each ratio, but I want to combine the charts and have multiple trendlines for multiple data series in a chart.
I am trying to combine ~300 workbooks into one single workbook. All 300 workbooks have the exact same header. I tried using the code from thread http://www.excelforum.com/showthread.php?p=696435 but nothing is being copied over. The only difference between my example and the other is I only need to take data from the first sheet in each data workbook. All the workbooks are located in following directory .....
I have 2 sheets with a list of account numbers and values on each (Column A = AccountNumber, Column B = Amount) I want to combine this on Sheet3 which should include all accounts on the other 2 sheets. Some AccountNumbers only exist on on one of the sheets.
I'm importing some data from an HTML table into excel, it all formats pretty well except that some of the data appears on multiple rows.
A B C 1 01.02.06 John 2 Bob 3 Sam 4 02.03.06 Jim
What I need:
a b c 1 01.02.06 John, Bob, Sam 3 2 02.03.06 Jim 1
What I need to do is get all the items in the colum B which are listed under the same item in column a, in the first case John Bob and Sam and put them all into the same cell. I then want to delete the empty rows. It's important that this is done by testing to see if column A is blank, rather than using the date.
then in column C I want to count the items in column B, ideally then repeat the script for the whole sheet.
Not a clue of the type of syntax I should be using though! In fact there's probably a better way of importing the data from the HTML so it doesn't even need to be done this way! of course I'm oblivious to it. Auto Merged Post Until 24 Hrs Passes;Thinking maybe I didn't make myself properly clear....
If a cell in column a is empty then it means the item in column b needs adding to the end of the item in the row above in column b.
I use a program called Fishbowl for inventory management. Each day, the program generates a report of all orders fulfilled that day as a .csv file. I want to create a macro that will automatically open this file daily, reformat it, save it as an Excel file and email a .pdf of the reformatted file to my boss.
I can work out the formatting, and emailing. Where I am having trouble is right up front. The program saves the .csv file to a folder with the name Shipments today YYYY-MM-DD HH-MM
The report is generated each day at 18:00 so that part of the name remains the same, but the date changes daily.
If I ran the macro at 18:10 each day, is there a way to code it so it can open the right file?
I'm looking for a way for Excel to combine formulas together into a more compact form for me.
Attached is a very simple version of what I want, my actual formulas are very complex but I'd still like a way to have them automatically combined into a single cell.
Alternatively, what is a good way to break down a very complicated one-cell formula and still keep things organized?
Here is the one-cell version of a formula I work with.
[Code] .......
That formula is difficult to work with in one cell, so on another sheet I have it broken down into parts so that if one part isn't doing what I want I can change it. This takes up a LOT of space because of the other steps I do (the above formula is just one step) and I'd like to combine it together.
Attached File : Excel Formula Combination Question.xlsx‎
I've pieced together code from a number of solutions on the forum and figured out how to find the files I need to process, but can't seem to figure out the code to actually combine/append each worksheet into a single one. I've searched the "sea of options" on this forum and managed to do one thing well. Pardon all my notes embedded in the code below, but if I don't do it that way, I'll only confuse myself further (which is easily accomplished) ... or lose my notes!
I’m going to run this code from an add-in menu, which is already created and working (yeaah!) … so (I think) I need to have the code either create a file named "Master (Combined).xls" in the target folder ... or ... have a file already created in MYFOLDER and have this code delete all but the header row when the file is opened(???) The "Master (Combined).xls" workbook needs to consist of one worksheet named "Master". I want it to open the current workbook (.foundfiles(i)), select all the data, and append it to the master workbook on the "Master" worksheet (sheet 1). The Master Worksheet in the Master Workbook needs to start out as a blank sheet ... except for the header row. I can add code to put the headers in at the start, if necessary
Sub g_CombineMultWB_AllXLSFiles() ' This Will combine all XLS files located in the ' S:DMSMSPOMSMaster POMS NIIN DataMaster EMALL Data FilesEMALL Excel Folder ' into a single worksheet in a newly created (or previously existing) workbook ' ' LOCATION OF FILES (ACTUAL): ' S:DMSMSPOMSMaster POMS NIIN DataMaster EMALL Data FilesEMALL Excel Folder
Dim i As Integer Dim wbResults As Workbook Dim wbCodeBook As Workbook Application.ScreenUpdating = False Application.DisplayAlerts = False Application.EnableEvents = False ' Application.CutCopyMode = False ' DO I HAVE THIS HERE FOR A REASON???
On Error Resume Next
Set wbCodeBook = ThisWorkbook Const MYFOLDER = "S:DMSMSPOMSMaster POMS NIIN DataMaster EMALL Data FilesEMALL Excel Folder" With Application.FileSearch .NewSearch ' Change path To suit.............................
I've got problem with combining 3 cells into one. First cell contains text, second have date yyyy-mm-dd and last one is as previous. I'm using formula .
[Code] .....
And I'm getting: TEXT_41694_41701. How can that be corrected to use formatting for date format to get TEXT_yyyy-mm-dd_yyyy-mm-dd?
I have 2 pivot tables in an Excel Sheet (Pivot A and Pivot B). They have different structures i.e. the table headings are different. I need to sum the "Grand Total" values from each of these pivots. Can anyone explain if the following is possibe:
1. Can you combine 2 pivots with different structures in order to acheive a single Grant Total value?
2. Can I create a formula which adds the 2 separate Grand Total Values?