Excel : Copy muitple columns to rows based on one column - excel

I'm looking for the most efficient approach to transferring information from three columns to one row, right next to each other depending on the company name.
Consider the following example:
I have a 226k data list with product details for several customers (around 30-40k).
One customer can have 2 to 50 products, each with a serial number and a product number. Check out the source data pic.
Output required: One row per customer will have all the product data, serial number, and product number next to each other.
Source data
desired output
I have never used Macro. Can someone please help me find the best way to deal with this issue?

This one is pretty tricky, you'll need to play with column numbers to adjust formula:
The customer list in column F must be typed manually or if you have Excel 365 you may benefit from UNIQUE Function. I did it manually.
My formula in cell G2 is an array formula (must be entered pressing SHIFT+CTRL+ENTER or it won't work!
=IFERROR(INDEX(SI($D$2:$D$14=$F2;CHOOSE(COLUMN()-6-INTEGER((COLUMN()-7)/3)*3;$A$2:$A$14;$B$2:$B$14;$C$2:$C$14);"");MATCH($F2;$D$2:$D$14;0)+INTEGER((COLUMN()-7)/3));"")
Drag to right and then drag to down.
My formula uses the value 6 and 7 because my data starts at column G, that means column number 7. So if you put this somewhere else, make sure you change also 7 and 6 values to the proper values!
Anyways, I've uploaded a sample to Gdrive in case you want to check the formulas by yourself.
https://docs.google.com/spreadsheets/d/1TvNUVt0ArzyFK_jsRtZfX1ja2zUgSdhR/edit?usp=sharing&ouid=114417674018837700466&rtpof=true&sd=true

Related

Getting Top Values from One Sheet and inputting onto a different sheet

So I'm going to eventually have 3 sheets. Sheet 1 is where I have data (numbers for a category and a name associated with it. Sheet 2 is where I pull the top 5 users for each category. Sheet 3 is where I have a leaderboard for points gained.
Right now I'm trying to work with Sheet 2 (grab the top 5 performers from each category. I'm fairly new to Excel, but after some research it seemed that XLOOKUP would be the way to go. (i'll attach screenshots below.
I'm using this formula:
=XLOOKUP(LARGE('Cases Test for Categories'!$C$18:$C$55,1),'Cases Test for Categories'!$C$18:$C$55,'Cases Test for Categories'!$A$18:$A$55)
however when using it I get all 0's.
Here's a screenshot of values I'm trying to grab from "Warranty Service Request"
and here is a screenshot when applying my formula
The solution I would want is to grab the 5 largest numbers from sheet 1 with the person name as well.
I don't think that XLOOKUP can get you anywhere near what you want but the formula below will get you one step closer.
=INDEX(List,MATCH(LARGE(INDEX(List, ,2),1),INDEX(List,,2),0),1)
In fact, it's the explanation of that formula which will be of help. Here we go.
List is a named range, perhaps equal to your 'Cases Test for Categories'!$C$18:$C$55. The reason for using a name is obvious. It's shorter. In my test List = A2:B6, in case you want to reconstruct it. Column 1 has names, column 2 numbers.
The term INDEX(List,,2) specifies the second column of List. You can replace the '2' with a formula to specify different columns of the named range.
In fact, INDEX(List,,1) does specify the first column and INDEX(List,4,1) specifies the 4th cell in that column, and that is exactly what you see in my formula. All of MATCH(LARGE(INDEX(List, ,2),1),INDEX(List,,2),0) just serves to find the row number in List, in this example the number 4.
Of course, LARGE(INDEX(List, ,2),1) returns the largest number in column2 of List. The '1' can be replaced by a formula, for example ROW()-1 which would return 1 if placed in row 2 and count up from there as it's copied down. Try =ROW()-1 in any cell in row 2 and copy the formula down.
MATCH([LARGEST],INDEX(List,,2),0) returns the row number where the largest was found, and that is the number we need to return the name from the first column of List.
This will work perfectly for one column and can easily be modified to work for different columns. Your question doesn't specify how you would like to arrange the 5 results from each category but the formula can be modified a little to accommodate whatever you want. What it can not do is to deal with ties. MATCH(LARGE can only find the first of several identical results.
To break ties in this sort of operation is complicated and must be done ether by helper columns in the data table or using VBA. It's definitely the topic of another question. For now I hope that it's a problem you will not have to anticipate.

Locate duplicate information between two spreadsheets

I run an open order report for a warehouse team every two days, and then go through the open orders; and email vendors to confirm their delivery date as pointed out by the report.
Naturally the reports are going to have some of the same information every other day, but there will be new orders, as well.
What I need to be able to do is figure out a way to tell the new spreadsheet to determine if any of the information in the new sheet was in the old sheet.
For example.
A, B, C, D, is Delivery Date, Part Number, Part Description, and Purchase Order Number - Respectively.
Information in spreadsheets in internal and confidential, otherwise I would post a photo of it, to help understand.
I want it to tell me if those items match between both spreadsheets, so that I don't suddenly end up asking twice about an order or have to go line by line to match up. Because that takes FOREVER.
Assuming the purchase orders are unique day to day, you can use the match function in a column on the new orders page to see if the same PO is on the old PO's tab. If you get a #N/A the values are unique. Otherwise, Match will return the row number of the matching value.
If you need to match on multiple values (e.g. Date, PO, Part#) then use the concatenate formula to create a multi-part key.
=Concatenate(Text(DateCell, "YYYYMMDD"),"_", PO,"_", Part#)
Then put the same formula on both sheets and do the match on your new key column.
If you want to test for equality across all items, you can do it easily with an array formula. Here is an example that compares 4 columns (similar to you) for exact matches. It multiples the combined result by ROW so that you can see where the last match occurs. It is the last one because MAX is used.
Hopefully you can see how this would be extended to your case. Note that this is an array formula (entered with CTRL+SHIFT+ENTER) in cell F2 copied down through the column.
Formula in cell F2
=MAX((A2=$H$2:$H$21)*(B2=$I$2:$I$21)*(C2=$J$2:$J$21)*(D2=$K$2:$K$21)*ROW($H$2:$H$21))
This formula works by building up a product of comparisons which is the same as an AND operation. This will be a 1 if the conditions are all true. That 1 is then multiplied by the ROW so that the match location is returned.
Picture with a couple matching rows colored and the ranges in color to see how the formula works.

Get highest values across columns

I have a worksheet with colums of names and amounts. The names are in (C2:C33,J2:J33,Q2:Q33,X2:X33). The amounts are in (G2:G33,N2:N33,U2:U33,AB2:AB33).
What I'm trying to do is find the highest 8 amounts, with the coresponding name. Meaning, for example - the name in C3 corresponds to the amount in G3, the name in J3 corresponds to the amount in N3, etc.
Using:
=LARGE((G2:G33,N2:N33,U2:U33,AB2:AB33),1)
I am able to find the top 8 values (by changing the 1 to 2, 3, 4, etc.). I couldn't figure out how to 'bring along' the name with that, so I kept searching. I found an explanation that gave me this:
=INDEX($C$2:$C$33,MATCH(1,INDEX(($G$2:$G$33=LARGE($G$2:$G$33,ROWS(N$36:N36)))*(COUNTIF(N$36:N36,$C$2:$C$33)=0),),0))
Copied down 8 cells will give me the names of the highest 8 combinations, but only from that first grouping of column C using column G values.
I've been searching for how to do this for the past few weeks, and I've run out of ideas. I don't know if I can modify the first formula to also grab the names, or the second formula to go across the other 3 corresponding groups. Once I get the top 8 names and amounts on the first sheet, I need to compare those to the top 8 on more than 100 other sheets to get the top 8 overall.
Does that make sense, and is it even possible? Do I need to use VBA? I'm running Excel 2010, but I don't know if the solution will be version specific. A thousand thanks if someone can figure this one out for me!
Not completely sure what you are asking for but here is a set of normal excel code that will provide you with the first instance of the highest value and return it's corresponding cell.
=INDEX(C2:C33,MATCH(MAX(G2:G33),G2:G33,0),1)
If you are asking for the 8 highest values in that column... you would use
=INDEX(C2:C33,MATCH(LARGE(G2:G33,[replace with 1-8]),G2:G33,0),1)
Edit: Of course it won't work if there are two numbers with the same value. In that case I would use VBA, pull the numbers into a 2D array and reorder the array based on the values in column G.

assigning a value based on another column in Excel

I am trying to find a quick way to assign a value for a column depending on the value of another.I want to increase the value of column A by one each time the value of column B changes.
Column A Column B
1 (520)998-7765
1 (520)998-7765
1 (520)998-7765
2 (450)877-4563
2 (450)877-4563
2 (450)877-4563
2 (450)877-4563
3 (650)989-7654
3 (650)989-7654
3 (650)989-7654
.... ....
I need to know if there is a formula that I can use to sort through 27,000 lines of data rather than assigning them one by one.
I am using a phone number as a unique identifier and I want the ID# to increase by one every time the phone number changes.
Please Help!!
Put value "1" in A2.
In A3 and after put the following function
=IF(B3=B2,A2,A2+1)
EDIT
You can make a single formula for all of the rows.
Put something like this in A2 and copy it down:
=IF(ROW(A2)=2,1,IF(B2=B1,A1,A1+1))
It seems like you are trying to extract the unique list of phone numbers? If so, there is a Remove Duplicates function in Excel (under the Data tab) that should do what you need.
You would select your full range (27,000 phone numbers) and run Remove Duplicates. Excel would then leave behind a single row for each unique number.
I believe Remove Duplicates is available for Excel 2007 or later.
If you are using an older version of Excel, here is a link that gives more information on filtering for a unique list:
Count unique values among duplicates

Referring to another sheet's cell depending on the value of another

Not quite sure how to word it, but I'm currently doing a project on excel. So far I have the invoice sheet containing the customer number and pricing etc etc, and another to contain all customer information such as their home and email address and phone numbers in order of their customer number.
I am currently trying to have a formula automatically add the name of the customer depending on the number entered in the invoice. By this, I mean that when I enter a number in the column, it will refer to the customer spread sheet and retrieve the name. But I'm not sure how I will do this.
The only thing that comes to my head, is that logically it would be something like '=Customers!B(D3)', where D3 is the customer number. I would have thought that it would get the value of D3, and say D3 contains the number 3 then it will go to cell B3 in sheet Customers.
I'm not sure how to do this, so is there some sort of GetValue function? I mainly code Java so am fairly new to Excel.
Any help would be greatly appreciated,
Thanks :)
There is a few different functions you could use for this but the best would be INDEX
To get the value in Column B use =Index(Customers!B1:H100,D3,1)
Column C =Index(Customers!B1:H100,D3,2)
The first argument is the range, second argument is row position, and third position is column position.
Here is some documentation to read

Resources