Take 4 columns of identical data from 2 sheets with 2 columns of unique, sort by common - excel

I've tried several VLookup strings and couldn't get it. Apologize in advance if this has been covered but spent hour and half looking/trying.
I have 2 inventory sheets. Columns 1-2 are identical on each (part #, Description). Column 3 has the inventory count for each period. I'd like to put them on one sheet with data lining up across rows. Problem is the #s aren't in same order on each sheet. Tried copy/paste and sort by Part#, then Part # but they don't match for some reason. Thank you so much. Chris.
Part # Description Count Part # Description Count
29169 SERIAL NUMBERL 300 50001E Impulse Finger 7,234
50010 Air Reject Bae 45 72000-S Chromax HD Ill 28

Name your value ranges as "Inventory1" and "Inventory2"
Go to Data>From Other Sources>From Microsoft Query
Then, select excel files, navigate to your workbook, and select both your ranges into the selection box.
Go into your Microsoft Query, and click the SQL button.
Select Inventory1.PartNum, Inventory1.Description, Inventory1.Count
FROM C:\$\Inventory1 C:\$\Inventory1
UNION ALL
Select Inventory2.PartNum, Inventory2.Description, Inventory2.Count
FROM C:\$\Inventory2 C:\$\Inventory2
Basically, this query will join your two ranges on top of each other based on the columns in the respective query (i.e: Partnum on Partnum).

Related

What to use: COUNTIF or Vlookup or combined or else?

I got a big data file where I have to count how many events is per one serial number (in my case P/N) through more sheets (years). Those serials are in Column A (grey). On second picture is lookup table, so the data from where I have to search and Count events looking at (Column O - yellow) and Column A (artikel), using terms from Column P for all the sheets, I mean through different year. All sheets are consistent and looking exact the same.
What I tried to do is: COUNTIFS(A2:A142;VLOOKUP(A2;'Spareparts 2015'!$A$2:$O$164;15;FALSE))+COUNTIF('Spareparts 2015'!O2:O164;"Ersatz im Rahmen einer Wartung") to look for specific term but this is not what I wanted.
Idea is to get all these specific "terms" using P/N through all years (summed), to see how many times serial number (P/N) has been used through years. And I need total number (of 5 years). As you see in main table there are more serials, and everything what is needed is some good positioned function which I cant get...
Hopefully I was clear with my issue, it is a bit hard to explain, but I eager to provide more infos!
UPDATE!
This is actually what I wanted to accomplish (with Pivots is possible)
For every Serial (artikel) that I have in Calculated sheet, I wanna look and count all instances (Grund fur ersatz in Column O) through years and different sheets. Every sheet has mixed serials, and these occurrences, so I have to couple them with main table and to count total number of them, how many times something from Column O appeared in some of Serials through 5 years.
One option is using Pivot tables actually, but I wanted to know how I can solve it with formulas also.
EDIT #2
Given that the relationship between each serial number and the look up term is 'Many to Many' but not 'One to One', one way to count the occurrence of each term for each serial number is to
Firstly put all 5 years of data into one big table, and name the following ranges:
Name_All being names in Column O of the master data table;
SN_All being serial numbers in Column A of the master data table.
Secondly, create a look up sheet to list all serial numbers and associated look up terms as shown below:
Then you can use COUNTIFS to count the occurrence for each term per serial number:
=COUNTIFS(SN_All,A2,Name_All,B2)
See following screen-shot for more clarifications.
A better/quicker approach would be using pivot table as being mentioned by OP.

How to merge data of two excel sheets into the third sheet with some cleansing operations

I have a homework assignment where I have to merge data of two excel sheets by performing some cleansing operations using formulas.
Sheet 1:
OrderID | Full Name | Customer Status
1001 Waqar Hussain Silver
2002 Ali Moin Gold
Sheet 2:
OrderID | First Name | Last Name | Customer Status
A1003 Junaid Ali 2
A2004 Kamran Hussain 1
Sheet 3:(Combined Sheet) - Expected
OrderID | Full Name | Customer Status
1001 Waqar Hussain Silver
2002 Ali Moin Gold
1003 Junaid Ali Silver
2004 Kamran Hussain Gold
There are probably a lot of ways to do this. First make sure the data is cleaned. If you are already 100% positive the data is clean you can skip this step. If you aren't sure it's better to be safe than sorry. For each column create a new column using the CLEAN and TRIM functions to remove any non-printable characters and any extra spaces. Something similar to =TRIM(CLEAN(A2)). Then drag the formula for each cell.
After this in order to merge the data together we need something to join on. The full name seems to make the most sense. On sheet two we'll write a new function to join the first name and last name together. The =CONCAT formula should work.
=CONCAT(First Name, " " ,Last Name). Make sure to note the extra space added by the quote. That way it matches the Full Name from Sheet 1. Looks like we'll also need to strip out the letter from Order ID in sheet 2. I'm going to assume that all Order IDs are 5 characters long. If this isn't true then you'll need a different solution. You can use =RIGHT(A2,4). This will grab the right 4 characters from the text string.
At this point let's create a distinct list. Copy the Full Names from Sheet1 and Paste them on to sheet 3. Copy the Full Names we created on Sheet2 and Paste VALUES onto sheet 3 below the full names from sheet 1. Then select all the rows in the column and go to the Data tab. Click "Remove Duplicates". This will now generate a distinct list of values.
We can now merge the data together using an INDEX MATCH. There are lots of great tutorials on how to use INDEX match in combination. It's a little long to explain on this thread, but this is a great thread explaining how it works. It's worth taking 10 minutes to fully understand it because it is a formula you will use thousands of times throughout your life.
https://www.deskbright.com/excel/using-index-match/
Let me know if I can clarify anything.
Best,
Brett

multiple lines made into 1 line of data

I have attached a picture of what im trying to do.
I run these reports on my techs once a week. on the left side of the picture it shows the service order number multiple times and then the the booked date and closed date the techs id number actual hours work and then sold hours. the problem is it has many lines with the same service order. i need to make it look like the line to the right. 1 usable line of data so that i can process the reports the way i need to.
Copy A1:E32 all your Data without column F and paste it in I1 it will be I1:M32 for example, select I1:M32 the new Data under Data Tab click on Remove Duplicates you will have one row for each different entry
If the Number in Ro-no (column I) is unique for each entry, use the following in N2:
=Sumif($A$2:$A$32,I2,$F$2:$F$32)
and drag it down
It will sum the Sold Hours in column F for each RO-NO
Change the references to include all your rows and keep $
Power query
One of solutions is to use MS power query addin. In Office 2016 and alike the PQ is built-in feature, located on the Data tab, Get and Transform group.
Let's say we have data like this:
We can use the Power query to Group By, like so:
The query will remember the steps you 'teach' it.

Count All Occurrences Between Stop 1 and Stop 2 Over and Over again (Count Until?)

I need to count all occurrences of "overall delays" that fall on each day, i.e.: How many delays occurred on 3/30 for car ABC and XYZ.
I think the best way would be to count all that occur between stops 1 and 2 (ie: First_Last) but can't figure out the best way to do that (something like countuntil).
I can NOT do a query (Google Sheets) since I need to upload this as a CSV file into a querying software.
Anywhere in L2 through L9 I need to see a count of overall delays for car ABC example.
Hard to explain! My actual sheets is over a million lines long with 600+ routes. Here is my example sheet.
Sounds to me like you want a pivot table. Select the data set. Click data --> pivot table report, and pick the relevant fields for your columns/rows/values.
Added it to your sheet. Here's what it looks like:

Moving data in an Excel spreadsheet, will I need to use VBA? If so, how would I go about doing it?

as cliche as it sounds, long time reader, first time poster. I'm currently helping a family member out with some work and he has to sort through several thousand records and slightly change the format, obviously without some sort of automation it would take tens of hours and he asked me if I could help do it quickly. At first I thought I could, but I'm a little over my head with some of this stuff.
Basically, he has this data in this type of format:
Sample No
1 Ag 20
1 Au 50
1 Cu 80
2 AG 1
2 Au 30
3 Cu 30
But we need the data like this:
Sample No. Ag Au Cu
1 20 50 80
2 1 30 -
3 - - 30
At first I thought I could do it with a formula to move the data horizontally. The only problem is the missing data would preferably be filled with a '-', but in the original data given they are just left out entirely, so Im assuming I'll need VBA.
Sorry if I left anything out, but any pointers in the right direction with VBA would be incredibly handy.
Thanks
EDIT: Fixed formatting and had two numbers switched, sorry guys.
You can use Pivot Tables for this.
Assuming your data is currently in a single column, you can do the following:
Data menu > Text To Columns, split on a space
With your three new columns, insert a row into A1
Give your three columns captions, such as Sample, Element and Size
Highlight your entire range, and select Data menu > Pivot Table and PivotChart report...
Select "Microsoft Office Excel list or database", and press "Next"
Select "New Worksheet" if you want the data in a new worksheet
From here, drop your Sample element into the left side of the table, the Element element into the top side of the table, and the Size element into the middle of the table.
You won't have dashes for your missing data, but this should do what you want.

Resources