Get data from table with multiple criteria Excel - excel

So i have information stored in a table. The columns are the date und rows are the Part. So i have another workbook open with different dates and parts but the table looks completely differnt with some addition rows in between. So i cant just copy&paste the data. I need a vba code to search for the correct entry and copy paste each single value. Similar to a index match function but in vba.
Could you give me some help how to start this?

So that would be my initial table:(Information 2)
Date 1 Date 2 Date 3
Part A 122 134 1212
Part B 453 3 4536
Part C 35 23 3
I need to copy that information into another table with different outline:
Part A Part B Part C
Info 1
Date1 Info 2 122 453
Info 3
Info 1
Date 2 Info 2 134 3
Info 3
Info 1
Date 3 Info 2 1212 4536
Info 3
How could i copy& paste the information into the new table?
How could i do that with index &match funtion?

Related

Get instances of rows in excel for a particular group [duplicate]

This question already has answers here:
Excel - order of occurrence / running total formula
(2 answers)
Closed 18 days ago.
I have dataset containing list of checks numbers.
Check
111
111
111
222
222
I am trying to have a new column in my dataset which would give me 1st, 2nd, ....nth instance for every check. The output would like something as below,
Check
Instance
111
1
111
2
111
3
222
1
222
2
To create a rolling count for a specific instance that appears in a range of cells, you can use the COUNTIF function with an expanding range.
=COUNTIF(A$2:A2,A2)

Copy&Paste Data Multiple Criteria Excel

I need to copy information from one table into another table and i am not sure how to do that.
So that would be my initial table:
Date 1 Date 2 Date 3
Part A 122 134 1212
Part B 453 3 4536
Part C 35 23 3
I need to copy that information into another table with different outline:
Part A Part B Part C
Info 1 - - -
Date1 Info 2 122 453
Info 3 - - -
Info 1 - - -
Date 2 Info 2 134 3
Info 3 - - -
Info 1 - - -
Date 3 Info 2 1212 4536
Info 3
How could i copy& paste the information into the new table?I think Index Match would work but not sure how.
Assuming you table starts from cell A1 as below,
Enter the formula in cell C2 as below,
=IF(MOD(ROW(),3)=0,OFFSET(Sheet5!$A$1,(COLUMN()-2),(ROW()/3)),"")
Drag it to the right and then down to complete the range. This formula refers Sheet5 which you can change it per your needs.

How can I merge rows in Excel 2010?

My Excel sheet contains columns for id, date, amount and name.
If two or more rows have the same id and name I want to merge them into one row with the amount of those two combined. Can anybody help me doing this?
Use concatenation with Columns ID and NAME (=ID&NAME) in another column and look for the pivot table. Move to Insert->Pivot table option to get the attached answer]
Hope this clarifies
Here is a possible solution (as far as I understand the problem) using a PivotTable:
As you can see, there is not really much to it. Just insert a pivot table and drag the ID & Name to the Rows while you move the dates and the values to the Values section of the pivot table. The Values in the Column section will be automatically generated.
The only thing I changed at the end was to format the pivot table nicely doing the following:
Remove SubTotals by name
Using a PivotTable style that I like from the PivotTable menu in the section Design.
Show items in a tabular format. That means that the name and the ID are shown on one row and not in a cascading format (ID in one row and the name in a second row underneath + indented). You can achieve this by right-clicking on the name and selecting Field Settings. A new window opens (showing the settings). Go here to the Layout & Print tab and select Show item labels in a tabular form. You might have to repeat that for the field Name and the field ID (depending on which of the two fields you chose to show first in the Rows section of the PivotTable).
Let me know if this solved your problem or if you have any questions.
Note: since no sample data has been provided I made some up. I sure hope this data is somewhat similar to what you are trying to aggregate.
Used sample data:
ID Date Amount Name
1 05.03.2015 121 Peter
2 14.01.2015 127 Max
3 11.01.2015 77 Eva
4 06.11.2015 141 Jamie
5 04.03.2015 58 Sophie
1 04.04.2015 94 Peter
7 20.06.2015 52 Lucas
3 14.12.2015 136 Eva
2 02.11.2015 93 Max
10 20.08.2015 59 Mason
4 11.01.2015 145 Jamie
4 02.02.2015 113 Jamie
4 26.02.2016 89 Jamie
1 30.03.2016 137 Peter
15 09.09.2015 81 Jackson
16 25.02.2015 61 Liam
2 26.02.2016 133 Max
2 26.10.2015 80 Max
19 25.09.2015 76 Aiden

PivotTable will not group ANYTHING

I have done some Googling and found other people had issues when their DATE fields were not true dates, had blank values, or where date values were not actual dates (e.g. 1/33/2015). However, none of these are true for my table.
I am also unable to group regular text fields into a new group like I used to be - I am working with ticket closures and want to Group "Cancelled" and "Completed" tickets into a Closed group and then all else into an Open Group.
I was able to do this on another Excel sheet a few weeks ago but now the option is completely grayed out.
Count of ETC Column Labels
Row Labels Closed-AS IS Complete New Pending Grand Total
John Doe 2 365 367
1/2/2015 2 2
1/5/2015 1 1
1/8/2015 1 1
1/15/2015 1 1
1/16/2015 1 1
1/20/2015 2 2
1/21/2015 2 2
1/22/2015 2 2
1/23/2015 1 1
1/26/2015 2 2
1/30/2015 1 1
2/2/2015 1 1
2/3/2015 2 2
2/4/2015 3 3
2/5/2015 1 1
2/6/2015 1 1
EDIT:
AHAH! Okay, so I've narrowed it down (still not resolved though). I am able to GROUP/UNGROUP utilizing an extrenal data source (in this case it's a .iqy file - or SharePoint List/Export). I am UNABLE to GROUP/UNGROUP when referencing a table defined on the actual workbook or on the Data Model.
This is not much of an answer but here's what I found.
PowerPivot, apparently, does NOT allow for GROUPING/UNGROUPING so if your data is added to PowerPivot's data model these options will be grayed out. Instead, you will have to "force" the data by creating new columns with whatever grouping logic you can build in DAX and then create a hierarchy out of them.

What VBA code options are there to group data into time buckets, copy it to another sheet, and loop for multiple parts (criterion)

I have two files:
File#1 contains customer with demand information. There are only three columns that matter to me:
Part#
Demand Qty
Demand Date
The file has thousands of lines.
File#2 is my own file which has more of an MRP setup:
columns are labeled with dates (weekly)
For each Part: There are the following rows:
Demand
Incoming Inventory
Net Inventory
My general idea was that I could somehow filter both files by part#, then have the code "sumif" the total demand by week, and copy it from the customer file to my file on the corresponding demand row. Then loop this for all part #s.
Part #s are constantly being added/removed in my spreadsheet(as new projects develop, and old ones phase out), so it would be ideal if the code didnt need to be maintenenced as my file is updated with new parts.
It seems like you could use a SUMPRODUCT formula to bring those numbers in without code. This example uses two sheets in the same workbook so you'd have to adjust slightly for different workbooks. In Sheet1 you have three ranges which I've named rngPartNum, rngDemandDate, and rngDemandQty. I used dynamic range names that expand with the data, but you could use cell references that cover a sufficient number of rows. The data looks like this
PartNum Demand Qty DemandDate
1 18 3/28/2011
1 6 3/30/2011
1 6 4/2/2011
2 18 3/28/2011
2 6 3/30/2011
2 6 4/2/2011
2 16 3/28/2011
3 3 3/30/2011
3 15 4/2/2011
3 9 3/28/2011
3 18 3/30/2011
Sheet2 has a week-end date and a part number on each row.
Part Week Demand
1 4/1/2011 24
1 4/8/2011 6
1 4/15/2011 0
2 4/1/2011 40
2 4/8/2011 6
2 4/15/2011 0
3 4/1/2011 30
3 4/8/2011 15
3 4/15/2011 0
The formula in the demand column is this
=SUMPRODUCT((rngPartNum=A2)*(rngDemandDate<=B2)*(rngDemandDate>B2-7)*(rngDemandQty))
That sums everything in rngDemandQty where rngPartNum matches A2 AND rngDemandDate is less than or equal to B2 AND rngDemandDate is greater than a week before B2. As long as you have every part number and enough weeks on your Sheet2, the total should match Sheet1.

Resources