Need to populate master list from many different sheets in excel - excel-2007

So lets say I have 3 different sheets each with information on them like this:
Sheet 1 Sheet2 Sheet 3
item1|2 item2|7 item1|4
item3|5 item3|6 item6|2
item9|7 item8|4 item7|8
The first part (code#) is a code for an item. The second number is the quantity of that item. What I need to do, is to be able to populate a master list which will pull the quantity of each item and sum them up. In the above case, the master list would look like this:
item1|6
item2|7
item3|11
item4|0
item5|0
item6|2
item7|8
item8|4
item9|7
I'm sorry if this is confusing but I really need some help!

Elaborating on #Skip Intro's solution:
Ensure all three sheets have the same labels (say Item and Qty), preferably in Row1.
Alt+D then P, select Multiple consolidation ranges and PivotTable, Next, Next.
Select your range from Sheet1 (say A:B), Add, repeat for Sheet2 and Sheet3, Finish.
Change Count of Value to Sum of Value, if required and might as well select PivotTable, PivotTable Options, Totals & Filters, untick (if necessary) Show grand totals for rows.
If you don't want (blank) to show either filter it out or restrict the data ranges (at the start) to less than whole columns.

Related

How would I use VBA to automatically populate an excel worksheet with data from the pivot table of a separate excel workbook?

I have two open Excel workbooks. One has some data in a pivot table, like so:
Row Labels Date
A 5
B 4
C 3
The other, separate workbook is blank other than Column A, which lists the same Row Labels as are in the pivot table, but possibly in a different order:
Row Labels
B
A
C
I would like to place a button on the second workbook that, when pushed, will automatically populate the row labels with the appropriate columns from the pivot table, in the correct order.
I know that VLOOKUP will be involved somehow, but I am not quite sure how to get there. Ideally, it would be nice if this VBA code could be dynamic, so that the button would work no matter the size of the pivot table, and no matter how many row labels will be in the second workbook.
Use the GETPIVOTDATA function - for example:
=GETPIVOTDATA("Date",[PivotWorkbook]Sheet1!$A$1,"Row Field",$A2)
The workbook containing the Pivot Table must be open to calculate the result.

Pasting two similar tables with different and variable amount of data

My problem is that I have two tables (with the exact same format, headings and everything but with different amount of data and it can change over time) in two different worksheets. How can I unify them in a new worksheet (paste one of them above the other). I would like a macro to do this so I can avoid manual pasting. Thanks a lot in advance.
Instead of a macro you might want to consider referencing. For this, the number of cells in each table must be defined. Let's say you have 100 rows in table 1 (sheet 1) and 100 rows in table 2 (sheet 2).
A101 (in sheet1) = Sheet2!A1 and drag that formula for the next 100 rows. Good luck.

Macro or method to pivot data in Excel?

I am looking for a way to dynamically pivot data in an Excel sheet to put the data in a universal format no matter how wide the data set is.
For example: I want to be able to take a spreadsheet that could have 5 columns, 30 columns, or x number of columns to make it pivot to a universal format that is only three columns wide.
Here is a sample of how the original data could look:
I want it to look like this:
Is there a way to do it, either by macro or using any other Excel functions?
Assumes labels/data is in Sheet1 starting A1.
Insert a new ColumnA.
For Excel 2003: Activate any cell in your summary table and choose Data - PivotTable and PivotChart Report:
For later versions access the Wizard with Alt+D, P:
Select Multiple consolidation ranges and PivotTable and click Next >.
In “Step 2a of 3”, choose I will create the page fields and click Next >.
In “Step 2b of 3” (not shown in the modal!) specify your summary table range in the Range: field (A2:E6 for the sample data) and click Add, then Next >.
In “Step 3 of 3”, select a location for the PivotTable (the existing sheet should serve, as the PT is only required temporarily):
Click Finish to create the PivotTable:
Drill down (ie double-click) on the intersect of the Grand Totals (here Cell L4 or 16):
The PT may now be deleted.
In A2 of Table:
="Summary"&RIGHT(B2)
Convert the resulting Table into a conventional array of cells by selecting Table in the Quick Menu (right-click in the Table) and Convert to Range.
In a spare column starting in Row2 series fill integers down, from 1 to however many rows of data you started with (4, in the example). Then series fill that series to suit.
Sort sheet by that (spare) column, Smallest to Largest, with My data has headers checked.
Delete Row1 and spare column and hopefully you will end up with:

Find Last Row of Name with constantly changing names

I'm really stuck on this one. I have a spreadsheet with thousands of rows. I use this code to filter them based off of product in the E column.
Sub IsolateCCENCE()
Dim Operations As Workbook
Dim Operations_Sheet As Worksheet
Set Operations = Workbooks("Operations for Macros")
Set Operations_Sheet = Operations.Worksheets("Operations")
Operations_Sheet.Range("$A$6:$AH$13108").AutoFilter Field:=5, Criteria1:="=CCE" _
, Operator:=xlOr, Criteria2:="=NCE"
End Sub
Which works and leaves me with just under 1700 rows. Within these rows, in the A column, there are company names. Each company takes up approximately 20 rows. Each row represents a payment and has a corresponding date, in the D column. I need a macro (I'm assuming with a loop) that will then do the following:
Go through the rows, find the last row for each company
In that row, find the corresponding date
If that date is within 30 days from today, generate an email
Part 3 is easy. But Part 1 and 2 I can't seem to get. The data is always going to be changing.
Maybe it would be easier to have all of the data copy and pasted into another spreadsheet and then filter through every single company, find the last row (and thus the corresponding date)? But I don't know I would have a macro defined to filter through each company when the company names will be changing constantly.
I appreciate any help. Thanks in advance!
If a specific company name in say F1 then:
=MIN(IF(A:A=F1,D:D))
entered with Ctrl+Shift+Enter should give you the earliest date for the company named in F1, that if more recent than today()-30 (or less far into the future than today()+30 ?) you might use for your e-mail trigger (subject to other filtering etc).

Display Value from PowerPivot FieldList

I want to show a value in a cell of Excel which is coming from PowerPivot Field List.
How to show its value in Cell?
You have a couple of options to show a value from a Power Pivot model in a cell in Excel.
1) Create a pivot table with only the values for the field that you want. You can do this by opening your Power Pivot model and clicking Pivot Table on the home tab. Locate the field you want and put it in the Rows. You can remove the grand total by going to the design tab in the PivotTable Tools group and choosing Grand Totals -> Off for Rows and Columns. You can type your own heading in the row that says row labels.
2) Use a slicer. Add a pivot table, then click Slicer on the Insert tab. Select the field you want to show and click OK. You can delete the rest of the pivot table if you don't need it.
3) Use cube functions. You can get a list of values for a certain dimension by creating a set and then cuberanked members. For example, I have a Power Pivot model with a field called cities. My cube set is in cell G1.
=CUBESET("ThisWorkbookDataModel","[Location].[City].[All].children", "Cities")
In the cells in column G below G1, I can copy the following cuberankedmember formula.
=IFERROR(CUBERANKEDMEMBER("ThisWorkbookDataModel",$G$1,ROW()-1),"")
This gets the list of members from the set in cell G1 and lists out the member in order. so you need to copy that to as many cells as there are values. I used ROW()-1 to create an autonumbered list that starts with 1. So in cell G4, I'm saying "get me the 3rd city. Since the number of members can change, I added the IFERROR. Normally, if you ask it for more members than are present, it will return #N/A. IfError catches that error and returns a blank string instead (this is purely for cosmetic purposes and can be left out).
You can see the results of the 3 options below.