I've lost days to this problem.
To solve this issue I have amassed 6 sheets of different data with different attempts. I've tried offsets, dynamic ranges, vlookups, counts, countifs, left, right, row, everything. I can't get around it.
What I want to do is transpose data in the following format:
Into its correspondingly named four columns to reach the desired outcome:
Inconsistency of each individual product's data is the issue. Product 9 has two product options and two prices, whilst the tenth product has no description and no options.
I also have the original data in the following format if it is of use.
Any help or resources greatly appreciated.
I have gotten by with excel for the past few years without learning VBA, therefore a formula approach is most welcome. Though, if necessary, I am not massively intimidated by learning the language if needs be as I am a novice in CSS and HTML and dabbled in a couple of programming languages.
Edit 1 - A more concise way of viewing the issue is contained in this image where the data is on the left and the outcome is on the right.
Edit 2 - This is a link to a google sheet subject to request in the comments below. I have included all relevant information and some other stuff.
EDIT: you've added clarification since I put this together. I'll leave it in, because it is a partial solution and may lead you/someone to a full one.
(it supplies only 1 result if there are multiple matches for a particular product and information type, but handles missing information).
I have a solution. In your second example of the input (product #, type and information columns across the top), insert a new column between B and C. In the first data row of that new column, combine the text from the product # and 'Type' columns, i.e
C2 = A2 & "," & B2
Result of C2 should be "Product 1,Product Name"
Then for your transposed results table, all you need is a valid list of product #'s, and you can use a simple vlookup on C and D columns. You just have to construct a matching search term that combines the required product # with the type you are looking for.
The formula in H2 below is constructed so that you can drag it across and down as necessary.
You'll get N/A for anything that doesn't have an entry, and you'll get whatever vlookup usually does if it finds duplicate matches.
Related
I have created an excel sheet to have an overview over costs in my projects, however, I also need an overview of costs per category in my projects. I googled it and tried to find examples online, however, it only returns a value of 0, which shouldn't be the case. Can anyone help me? The sheet looks like below.
I am going by the SUMIF function to group by category but my excel sheet is a bit more complex than that so I tried to adjust it accordingly as seen in the code below. No matter what I do it either returns an error or 0.
=IF(B12=B8;"";SUMIF(B12:B39;B12;J12:BE39))
In the formula above I am trying to sum the costs of a category that could be written in B12, for example, Software development. For confidential reasons, I cannot show the actual filled out excel sheet.
sumif does not work with summing multiple columns. Instead use a sumproduct statement instead like so:
=IF($B12=$B$8;"";SUMPRODUCT(($B$12:$B$39=$B12)*($J$12:$BE$39)))
A detailed explanation to how this works can be found here
Edit:
I sense a follow up question coming, how to skip certain columns. Because as you have set it up now, it will count the entire range from J12 to BE39, in which you have both forecast costs and actual costs. I guess this is to compare the costs to what was projected and what the actual costs are. Right now it will count both the projected and actual cost, doubling up. To prevent this you can enter every second column separated by a + like so:
=IF($B12=$B$8;"";SUMPRODUCT(($B$12:$B$39=$B12)*($J$12:$J$39+$L$12:$L$39+$N$12:$N$39)))
Also I have added $ signs to all non-changing values so it will work when dragging down the fill handle on the formula to populate the below cells.
I am trying to get a dedicated material table in excel. So we have a few products and these products require particular materials. I know how much and which materials go in particular products. I also know how much is sold in which year, now I want to calculate the required materials for these years. Because the productbase is large (>100), and thus >100 columns, I would like to use some lookup or index function to automate the multiplication.
As shown in the picture, I tried using a sumproduct, which was also explained in some other question on stackoverflow. This sumproduct should multiply all values obtained in one table with the corresponding values in the other. I feel that something is not right about my first two match functions (see picture again)
The code used:
=SUMPRODUCT(INDEX($B$19:$E$22;MATCH(B$2;$A$19:$A$22;0);MATCH(B$10;$B$18:$E$18;0));INDEX($B$3:$E$5;MATCH($A11;$A$3:$A$5;0);MATCH(TRUE;$B$3:$E$5>0;0)))
The image contains some extra info and explanation of the actual need
The reason that it needs a lookup or index is because the products in table 3 are always in another order than what is shown in table 1.
I would like to have this sumproduct as automated as possible, thank you in advance:)
You could try and adapt the below:
Formula in B11:
=SUM(INDEX($B:$B,MATCH($A11,$A$1:$A$5,0)):INDEX($E:$E,MATCH($A11,$A$1:$A$5,0))*TRANSPOSE(B$19:B$22))
Entered as array, CtrlShiftEnter
Drag right and down into matrix.
Side-note: Be sure to edit your question to include all relevant information, including your own atempted formula, as text. Way easier to copy paste sample data that has been formatted as markdown :)
Thanks for any help here. I've been racking my brain (and searching online I promise) for a while on this one.
I'm looking at columns A and B that have unrelated information, but sometimes the information in columns A and B are duplicates. For example cell A2 says "Frank" and B2 say "1". then cell A3 says "Frank" and B3 says "1". The information is a duplicate across two columns. The rest of the names in this example can be anything, Frank, Sally, Robert, etc.. and the rest of the numbers in column B can be anything (Image of example attached). If the information is a duplicate I'd like to output a reduced list using two new columns.
These functions need to be operable in real time. As data is added the equations must update in real time. I also can't concatenate because I need info to stay in two columns. I've see a lot of examples of doing this for 1 column of data using an array (see example 2), but I don't know how to build one that considers two columns. 1 column example: =IFERROR(INDEX($T$2:$T$9, MATCH(0,COUNTIF($X$1:X3, $T$2:$T$9), 0)),"") Any ideas how to build this out so it works for two columns?
I'd like to avoid using VBA if possible, but if it's the only way so be it. I want to avoid using VBA because a lot of people touch the spreadsheet and it's a lot easier for me to fix a function than code. Gotta love humans!
Thanks so much for your help!
Robby
example example2
The simplest way that I can think of is:
a) Select your data, and paste elsewhere either on same sheet or a new one.
b) Select one of the cells in the copied data
c) Go to the Data menu tab, and click Remove Duplicates
d) Click OK
Create a new column C that concatenates columns A and B. Then remove duplicates on the basis of column C.
https://support.office.com/en-us/article/CONCATENATE-function-8F8AE884-2CA8-4F7A-B093-75D702BEA31D
I'm working on data from a population of people with allergies. Each person has a unique ExceptionID, and each allergen has a unique AllergenID (451 in total).
I have a data table with 2 columns (ExceptionID and AllergenID), where each person's allergies are listed row by row. This means that the ExceptionID column has repeated values for people with multiple allergies, and the AllergenID column has repeated values for the different people who have that allergy.
I am trying to count how many times each pair of allergies is present in this population (e.g. Allergen#107 & Allergen#108, Allergen#107 & Allergen#109,etc). To keep it simple I've created a matrix of 451 rows X 451 columns, representing every pair (twice actually because A/B and B/A are equivalent).
I somehow need to use the row name (allergenID) to lookup the ExceptionID in my data table, and count the cases where that matches the ExceptionIDs from the column name (also AllergenID). I have no problem using Vlookup or Index/Match, but I'm struggling with the correct combination of a lookup and Sumproduct or Countif formula.
Any help is greatly appreciated!
Mike
PS I'm using Excel 2016 if that changes anything.
-=UPDATE=-
So the methods suggested by Dirk and MacroMarc both worked, though I couldn't apply the latter to my full data set (17,000+ rows) because it was taking a long time.
I've since decided to turn this into a VBA macro because we now want to see the counts of triplets instead of pairs.
With the 2 columns you start with, it is as good as impossible... You would need to check every ExceptionID to have 2 different specific AllergenID. Better use a helper-table with ExceptionID as rows and AllergenID as columns (or the opposite... whatever you like). The helper table needs a formula like:
=COUNTIFS($A:$A,$D2,$B:$B,E$1)
Which then can be auto-filled. (The ranges are from my example, you need to change them to your needs).
With this helper-matrix you can easily go for your bigger matrix like this:
=COUNTIFS(E:E,1,INDEX($E:$G,,MATCH($I2,$E$1:$G$1,0)),1)
Again, you can auto-fill with this formula, but you need to change it, so it fits your needs.
Because the columns have the same ID2 (would be your AllergenID), there is no need to lookup them because E:E changes automatically with the auto-fill.
Most important part of the formulas are the $ which should not be messed up, or you can not auto-fill it.
Picture of my self-made example (formulas are from the upper left cell in each table):
If you still have any questions, just ask :)
It can be done straight from your original set-up with array formulas:
Please note that array formulas MUST be entered with Ctrl-Shift-Enter, before copying across and down:
In the example pic, I have NAMED the data ranges $A$2:$A$21 as 'People' and $B$2:$B$21 as 'Allergens' to make it a nicer set-up. You can see in the formula bar how that looks as a formula. However you could use the standard references like this in your first matrix cell:
EDIT: silly me, N function is not needed to turn the booleans into 1's and 0's, since multiplying booleans will do the trick. Below formula works...
SUM(IF(MATCH($A$2:$A$21,$A$2:$A$21,0)=ROW($A$2:$A$21)-1, NOT(ISERROR(MATCH($A$2:$A$21&$E2,$A$2:$A$21&$B$2:$B$21,0)))*NOT(ISERROR(MATCH($A$2:$A$21&F$1, $A$2:$A$21&$B$2:$B$21,0))), 0))
Then copy from F2 across and down. It can be perhaps improved in technique with sumproduct or whatever, but it's just a rough example of the technique....
My company receives weekly updates from different providers.They all give the same type of data but in a different order ( ex: one company will give column A= Name / column B= Quantity / column C= Cargo. When an other will give column A= Cargo / Column B= Name / Column C = Quantity ) . I think I need to create a Vlookup formula that would automatically find the new data, and replace the old one with it in the right place(if the data changed from last week). I understand that the formula will have to be different with every provider since they all have a different format.
To help you help me, I ll write the order of columns in our Template, followed by the order of one of the providers:
Our template
A:Reference Number
B:IMO
C:Vessel Name
D:Commodity
E:Product detail
F:Quantity
G:Departure country
H:Departure port
I:ETA
J:ETB
K:ETD
L:Current status
M:Destination Continent
N:Destination Country
O:Destination Port
P:Charterer
Q:receiver
Providers Template:
B:Vessel name
C:ETA
D:ETB
E:ETD
F:Departure Country
G:Departure port
H:Destination Continent
I:Destination Country
J:Destination Port
K:Commodity
L:Product detail
M:Quantity
N:Name of vessel
O:IMO
P:Reference code
Q:Charterer
R:Current status.
Any idea how to do this???
Okay based on your last response, I'm going to provide a potential solution with some caveats and assumptions.
Caveats
A VBA solution may be best here if the data is coming in from multiple source workbooks. However if this happens infrequently it wouldn't save you much time to do a VBA solution. Also if you are unfamiliar with VBA I don't recommend you simply paste in someone else's code that you got online - because it could be malicious, or it could lead you to be unable to actually do your job if some problem with the code arises that you can't fix.
Assumptions
-I'm going to assume that each vendor is included in the same workbook, on its own tab.
-I'm also assuming that the data is going to be somewhat consistent, as you noted in the comments to your question above.
-For now, I'm assuming that you only need a few fields from each vendor, and that those fields are always the same between vendors. This is not necessarily required to use this method, but it simplifies things a bit and will get you start. For now, let's assume you only care about the Vendor name, the cargo type, the quantity, and the expected shipping date.
Proposed Workflow
My general advice for someone doing a 'mini-database' in Excel like this is to keep separate tabs for their data dumps, their working formula sheets, and their summary tabs used for display/printing purposes. Keep your coding solutions only to the level that you yourself understand, and don't throw away the raw sourcebooks. Ideally if someone is reviewing / auditing your work they should be able to simply copy & paste in a random data sample and immediately see if it is picking up the right amounts.
So, My proposal would be to have a single summary tab, a data-dump tab for each vendor (also called a "landing page"), and an intermediary formula tab for each vendor.
The data dump tabs should contain the data exactly as it comes in from the vendor, without adjustments. Formatting your data-dump tab to match your raw data (rather than formatting your raw data to match your data dump tab) will mean that each time you update it, minimal intervention will be required. This is thus 1 step short of full 'automation'.
The intermediary formula tabs for each supplier should be in the same format as each other intermediary formula tab. This will allow for easier pickup on the main summary tab. The purpose of the intermediary formula tabs will be to give you an opportunity to look at that vendor's excel datadump, and determine the best way to pull the fields that you care about for review.
The summary tab will simply be a list of all vendor tabs, showing a grid of the fields that you care about from each.
Steps to complete
Using the "providers template" that you have in your question, dump that tab into "Provider A data-dump" tab.
In the "Provider A Formulas" tab, we will first type the provider's name as the sheet name. In cell A1, type "Index". In cell B1, type "Reference #". In cell C1, type "Cargo Type". In cell D1, type "Quantity". In cell E1 type "Shipping Date".
Column A will hold an index equal to the number of orders being shipped from that vendor. The formula in A2 will be "=1", and the formula in A3, and copied down, will be:
=if(row()<=count('Provider A Data'!M:M),row()-1,"")
This will count which row you're on, and if the row you're on is less than the total rows with numbers in the quantity field of the raw data tab, it will show that row number (-1 for the header). Otherwise, it will show a blank.
For the rest of it, if your data is truly consistent, then you can simply set the first cell in row 2 to be equal to a specific cell in the other tab. ie: B2, which shows the reference ID, could be simply:
='Provider A Data'!P2
Then just drag that down and it will pick it up as you drag. You will use your index key in column A to make sure you have dragged far enough.
There are formula solutions (like vlookup) which could be used to find a specific reference ID in the raw data tab and pull the exact row from another column, but you don't need to use those if you are simply keeping things in the same row-order as they appear in the data dump tab.
Then for your summary tab, simply create some columns that pull in amounts from each vendor. Once you have set up the workbook for the first time, all you'll need to do to update will be drag down rows in the formula tab. If you have further specific questions about how to achieve any of this, please ask in a specific question, noting what you have tried to do, and what part of that has failed.
I hope this helps you get started.