I need to do some aggregation and statistics on data and I'm thinking about doing that with Excel as the raw Data already comes in Excel format. Basically you could say it's kind of a log type of data with Datetime and some more information on each line.
I'm not yet clear what aggregation and other stuff needs to be done on this data but I already know that I need to merge new data into the then existing excel sheet every day or two. There is no real unique identifier in the data but the combination of 2 or more fields could easily be used for uniqueness. I wonder if there's a smart way to import the new data from time to time even if it contains already existing data then. Maybe something like copy it into a new tab/sheet then start some kind of import action where uniqueness gets checked?
I'm unsure if this can be done with Excel at all so please bear with me if the question sounds stupid to excel pro's.
Assume in a worksheet columns A and C can be combined for uniqueness. You could concatenate them to create an id:
In D2 = concatenate (A2,C2)
Then, add another worksheet of data, with this same concatenated column D added.
Then, add a third worksheet with a formula to only show unique data rows:
In worksheet 3 A2: =if(countif(sheet1!d:d,sheet2!d2))>0,"",sheet2!a2
In worksheet 3 B2: =if(countif(sheet1!d:d,sheet2!d2))>0,"",sheet2!b2
In worksheet 3 c2: =if(countif(sheet1!d:d,sheet2!d2))>0,"",sheet2!c2
This will create a sheet of unique ids with some rows (those that are unique) populated. You could copy and paste this as values only, the sort by any of the headings to get at the unique data only.
This is not the most efficient way to do this at all, but it will work in a pinch.
Related
I have a question regarding how I can overwrite data in a table depending on the values of one table.
I've had a look on various websites and forums and haven't quite been able to find what I'm looking for. I was wondering if you could please direct me to some links where I could learn how to create the code I'm looking for?
This is what I'm trying to do:
In worksheet 1, I have the following table:
In worksheet 2, I have a table where users can manually input data
I want to create a code whereby when I run it, the data in worksheet 2 overwrites the data in worksheet 1 depending on the reference number, so the table in worksheet 1 would look like this (highlighted sections) to show what looks different:
If you could direct me to any articles or forums that I could look up to help me that would be great.
You can use 3rd sheet to generate new table.
I assume reference numbers are unique. And if reference number exists in second table, all values (City, Earnings, Credit Card Type) are filled.
Let say first table is in Sheet1 and second is in Sheet2. Create Sheet3, add formula to A2 and drag it down:
=IF(IFNA(MATCH(Sheet1!A2,Sheet2!A:A,0),0),TOROW(HSTACK(Sheet1!A2:B2,VLOOKUP(Sheet1!A2,Sheet2!A:D,2,FALSE),Sheet1!D2,VLOOKUP(Sheet1!A2,Sheet2!A:D,{3,4},FALSE))),TOROW(Sheet1!A2:F2))
Result:
Formula checks if reference number exist in Sheet2 table. If not - it copies values from 1st table. If it exists, it combines row from both 1st and 2nd tables and spills it.
While I am a longtime 'lurker' and have gleaned a great amount of Excel knowledge through this site, I've never asked a question before. This time I'm really stumped...
I have a table with multiple columns. The data I'm working with is obtained from a multiple VLOOKUPs of another workbook for which I do not own. That workbook has some issues with hidden characters and rows that are hidden. I'm trying to create a dashboard from this data and was successful using the AGGREGATE function (2,7) to COUNT and omit the data I don't want.
The next tier for this data needs to incorporate a lookup against another column (image attached). For this, I want to look up data in column B and subtract cells in column C if the data in column B matches a cell in column A.
I have tried multiple ways of doing this but I think that AGGREGATE might be the best approach since it can ignore hidden data and rows.
My latest attempt was to add an IF statement as follows, but that results in a SPILL condition:
=IF('Transport Calendar'!E2:E830='Transport Calcs'!M6,AGGREGATE(2,7,'Transport Calendar'!X2:X830)-AGGREGATE(2,7,'Transport Calendar'!Z2:Z830),"FALSE")
Any help would most certainly be appreciated!
We sell our product via a number of different retailers. These shops send us reports of what they have sold and we need to import this into our new stock management system as a master file.
The stores do not and will not provide the data in a uniform way based on our desired template.
I therefore need a way of consolidating ranges of data that without having a unique ID for each line, with minimal manual formatting from the data importer to help save time.
http://s14.postimg.org/arslbnnxt/excelconsolidation.jpg
As you can see in the 2 examples above, nothing is in the same order and some of the supplied fields haven't been used. The column headers are static, only the data is actually pasted.
I've tried using the Excel Data consolidation tool but the SUM function just wants to add everything up or simply reports a single value, I've played with Vlookup but I then need to dedicate a number of rows to each store which results in lots of empty rows.
If you can point me in the right direction I'm more than happy to research the tool or function I need, web searches keep bringing me back to the consolidation tool.
Many thanks,
Since you say that column headers are static, you actually do have a unique ID.
The task can be accomplished by using HLOOKUP with Column headers as lookup value.
However, the formula will depend on how you organize or store input sheets from different stores.
Here I have tested a setup where each store input is pasted in consecutive sheets starting from 'Sheet1'. i.e. Store1 in Sheet1, store2 in Sheet2 ... with row 1 containing header.
Then in consolidated sheet using helper columns for identifying sheet and row number, the formulas look like this
in A2 =IFERROR(HLOOKUP(A$1,INDIRECT("Sheet"&$H2&"!A:O"),$I2,0),"")
in H3 =IFERROR(IF(INDIRECT("Sheet"&H2&"!A"&I2+1)="",H2+1,H2),"") (if no more records, increment sheet number)
in I3 =IFERROR(IF((H3-H2)=0,I2+1,2),"") (if sheet number changed, reset row number to 2)
Initial value for H2 = 1 , I2 = 2
Test file: Storefile
Need some advice, I have a large excel sheet that I need to break up by a value in column B. The kicker is in some cases i need more then one value from column B. Example I might want A and B together and C on its own. I have another workbook that has this mapping. I'm stuck on 1 Best tool for this job and 2 how.
In Excel im not sure how to make this work. I know i'll need a loop to go through the list, but how do i handle the ones that need to be combined?
In access I was thinking a table for the data and a table for my package list. The create a query and loop the values into the query using VBA.
I assume you want to break your main sheet to multiple sheets based on value in column B.
You can make use of excel vba dictionary
Does VBA have Dictionary Structure?
You need to load the workbook that has the mapping into the dictionary as below:
Key = 'value in column B'
Value = 'name of the sheet where you want that data to go'
Loop through the sheet containing the data get the value in column B, lookup in the dictionary to get the sheet name to which this data should go. Write the data into that sheet name.
Hope this helps.
I have several fairly good-sized Excel worksheets (indexed by WorksheetID) that essentially amount to flat database tables: rows are the records (indexed by DataRecordID within one worksheet), columns are the fields (indexed by DataFieldID within one worksheet), and the cells contain the field values (Value) for the appropriate records (or are blank).
I'm interested in breaking them apart to (many) records like this so that I can import them into MS Access:
ID | WorksheetID | DataRecordID | DataFieldID | Value
I've already done this manually. I see that it's probably a straightforward matter to write a VBA script to chug through the sheets and (optionally) delete the records in the final table.
My question is: Before I roll up my sleeves and begin coding, is there already a built-in capability in Excel 2010 that I don't even need to write a script to do this?
You don't need a script for this provided the data sources are of consistent layout. The basic process is described (with pictures!) here. However since that was considering a single matrix you will need a few extra steps:
Build in to the DataRecordIDs indication of their worksheet origins. Say with a formula such as =A2&"|WorksheetID" copied down to suit in a column inserted as a (new) ColumnB, for all sheets, assuming your first DataFieldID is in A2.
At Step #4 of the process (Step 2b of 3 in the Wizard) you would need to add the relevant ranges from each sheet individually.
Once you have the results Table you would then need to insert a new ColumnB and apply Text to Columns, Delimited with Other | to ColumnA.