Excel lookup based on multiple criterias - excel

I have the following problem: need to lookup for data based on 3 criteria:
Product type - Exact match
Product Height - loose values in ranges
Product Width - same as above.
I have a multiple tables like D3:I8 with cost of used components based on maximum product width&height for that range. in example 0 emerge on the intersection it means that product cant be constucted (width, height or both too large). we can make 2250mm x 700mm but 2250 x 1000 is impossible to make since 0. Those are only example datas in reality those numbers for width and height are diffrent.
Please can someone guide me through this problem?
(picture is worth more than a thousand words)

Assuming that the tables are always 6 rows x 6 columns, you can use Let() in 365 or just Offset in older versions.
Using Office 365 with the new Let() Function
=LET(myTable,INDEX(D:D,MATCH(L5,B:B,0)):INDEX(I:I,MATCH(L5,B:B,0)+6),INDEX(myTable,MATCH(M5,OFFSET(myTable,0,0,6,1),1),MATCH(N5,OFFSET(myTable,0,0,1,6),1)))
Or, if you don't have the Let() function, use this ugly compilation of Offset repeats:
=INDEX(OFFSET(INDEX(B:B,MATCH(L5,B:B,0)),0,2,6,6),MATCH(M5,OFFSET(INDEX(B:B,MATCH(L5,B:B,0)),0,2,6,1),1),MATCH(N5,OFFSET(INDEX(B:B,MATCH(L5,B:B,0)),0,2,1,6),1))
Edit: if the tables all have different shapes, then you may want to take the trouble of selecting each table and assigning them range names with the name manager, like "Type1", "Type2" etc. In the screenshot below I have the following range names:
Type1 ='Sheet1 (2)'!$D$3:$I$8
Type2 ='Sheet1 (2)'!$D$10:$G$18
Type3 ='Sheet1 (2)'!$D$20:$L$26
With these range names in place, you can use this formula:
=INDEX(INDIRECT("Type"&L5),MATCH(M5,OFFSET(INDIRECT("Type"&L5),0,0,ROWS(INDIRECT("Type"&L5)),1),1),MATCH(N5,OFFSET(INDIRECT("Type"&L5),0,0,1,COLUMNS(INDIRECT("Type"&L5))),1))

Related

Is it possible to get a value from a specific cell depending on several dropdown-list values?

I'm trying to create a program which extract values.
I have a bunch of data tables with specific values:
They are very similar to each other but the difference is the weight (3300 kg and 3500 kg) and altitude (0, 1000 feet and 2000 feet). I don't think I can combine them into one table.
On another sheet I have created 3 dropdown list where you can select temperature, altitude and weight - for example "+15°C, 1000 feet, 3300 kg".
What I want to do is to extract the correct value from the correct data table and put it in a cell. For "+15°C, 1000 feet, 3300 kg" the correct value for CTOD would be 5 for example.
Any friendly soul who can point me in the right direction?
EDIT: I combined all values into one table as commented, see image 2.
If all your data is in a single table, and you have specific parameters to filter and get a CTOD (in your case, those filters would be temperature, weight and Altitude) you can use the formula SUMIFS:
SUMIFS function
I've duplicated your data in a easy way, ignoring some columns. Then, I did 3 dropwdowns list, where I can choose parameters (temperature, weight and Altitude). Depending on selection, the formula will return one value or another.
As you can see, If I input OAT=+15, Altitude=1000 and Weight=3300, formula will return CTOD=5.
The formula is:
=SUMIFS($D$2:$D$28;$A$2:$A$28;G6;$B$2:$B$28;H6;$C$2:$C$28;I6)
I've uploaded a sample file to my Google Drive. if you want to download it and check the formula by yourself.
https://drive.google.com/open?id=1K7X14MuM84VH-7-nnMzGDfYs9Whjp-8-
Please, note this formula works because every single line is right. I there were duplicates (let's say there is twice the data relative to weight 3300, Temperature +15 and Altitude 1000), then the formula would return CTOD=10 (twice because the duplicate). So be careful with that.

Different aggregation functions for different dimensions in Excel pivot table

Can I define different aggregation methods for subtotals in different dimension in an Excel pivot table?
The following example shows a result I'm trying to obtain. The metric to aggregate is, let's say, lines of code of a software project. The 2 dimensions in question are Date and Organization. In source data, Organization is broken down into 2 columns, Department and Project, while Date is a single column and Excel makes up the Months/Years summaries automatically when making the ODBC data connection.
A metric such as this one should be aggregated differently along the different dimensions. For the Organization dimension, the subtotal for all projects of the department is the SUM, but in the date dimension, the subtotal for all months of the year is the MAX of any given month (or perhaps AVG, or last etc. but certainly not SUM).
I've tried to define the different aggregation methods in Excel in the field settings, but it always selects one or the other method for both dimensions. Is there a way to do it, preferably using standard Pivot Table mechanisms or at worst a UDF in Excel?
What I would do to tackle this problem is to add both aggregation functions: sum and max , then hide ( or shrink a lot ) those columns you do not want to display.
in the above example I shrink columns B,D,F and I because of they has values that are out of scope for your requirements.
The "Total Max of Loc" displays a value consistent with the function expressed throughout the entire column: that is "the maximum number of lines of code reached by each project in each department; this could lead to misunderstandings when we observe the values of the subtotals and grand total; i.e: The "Grand Total - Total Max of Loc" is not the "Total Max of Sum of Loc": in the example, it shows 18 which represents the absolute maximum value of Loc in a Project in each Department; In the same way the Total Max of Loc for Department 2 is 18 and form Department 1 is 12
When requested a different behavior as expressed in comment to this answer, I think we are entering into the strong customizations space and some solution could be found by writing custom macro and by leveraging the getpivotdata function or, if it can be acceptable for your case, simply by the addition of a new column with the max()formula and possibly hiding the column "Total Max of Loc"

Excel Sumif, Sumifs with partial strings in multiple columns?

So this is the simplified question I broke down from a former question I had here: Excel help on combination of Index - match and sumifs? .
For this one, I have Table1 (the black-gray one) with two or more columns for adjustments for various order numbers. See this image below:
What I want to achieve is to have total adjustments for those order numbers that contain the numbers in Total Adjustment column in the blue table, each of which will depend on the cell beside it.
Example: Order number 17051 has two products: 17051A (Apple) and 17051B (Orange).
Now what I want to achieve in cell C10 is the sum of adjustment for both 17051A and 17051B, which will be: Apple Adjustment (5000) + Orange Adjustment (4500) = 9500.
The formula I used below (and in the image) kept giving me error messages, and this happens even before I add the adjustment for Orange.
=SUMIF(Text(LEFT(Table1[Order Number],5),"00000"),text(B10,"00000"),Table1[Apple Adjustment])
I have spent the whole day looking for a solution for this and didn’t even come close to find any. Any suggestion is appreciated.
Assuming your headers always have the text "adjustment" in them, you could use:
=SUMPRODUCT((LEFT($B$4:$B$7,5)=B10&"")*(RIGHT($C$3:$F$3,10)="adjustment")*$C$4:$F$7)
In C10 you could add two sumproducts. This assumes that products are always 5 numbers long at the start. If not swop the 5 to use the length of the product reference part you are matching on.
=SUMPRODUCT(--(1*LEFT($B$4:$B$7,5)=$B10),$D$4:$D$7)+SUMPRODUCT(--(1*LEFT($B$4:$B$7,5)=$B10),$F$4:$F$7)
Which with table syntax is:
=SUMPRODUCT(--(1*LEFT(Table1[Order Number],5)=$B10),Table1[Apple Adjustment])+SUMPRODUCT(--(1*LEFT(Table1[Order Number],5)=$B10),Table1[Orange Adjustment])
Using LEN
=SUMPRODUCT(--(1*LEFT(Table1[Order Number],LEN($B10))=$B10),Table1[Apple Adjustment])+SUMPRODUCT(--(1*LEFT(Table1[Order Number],LEN($B10))=$B10),Table1[Orange Adjustment])
I am multiplying by 1 to ensure Left, 5 becomes numeric.

Create a Filter for Closest Value to a Specific Decimal Range

I've created a spreadsheet for choosing resistor combinations for an RC Operational Amplifier. I've used a list of available capacitors and resistors for my limiting values to produce values of one of the resistors based on the resistance and capacitance values of the available (standard) components. The values in my tables look like 7.23436793078690. I wish to apply a filter that will find the values closest to a whole number (1592.00188622182000). Then I wish to apply another filter that will compare those values to a list of available resistors and highlight resistors closest to the desired value. Many of the returned values of R2 are negative values so I also wish to filter values of R2<0.
For this spreadsheet I've used the equation R2=(Req)(R1)/(R1-Req), which is an equation to determine Req, for parallel resistors, that is solved for R2. In Column 1, the Rows are populated with values for available (standard) resistors. All other columns are populated with the equation for R2. The value for Req is obtained from another table in the Workbook that uses available (standard) capacitor values. Therefore, Columns B and beyond are labeled R2(C=.47 uF), for example. Essentially, Columns B and beyond reference the available (standard) capacitor values.
I wish to highlight the values I discussed in the first paragraph so I can quickly scan the workbook for the best possible value of R2. Then I can quickly determine the values of R1 and C to complete my task and minimize the tolerance for the given op-amp application.
I have some C++ programming knowledge and I have enough experience with Excel so I should be able to understand where and how to do what I wish to do but I wish to get some advice and direction from a more experienced Excel user.
***UPDATE***
Since my first post, I've done some research. It seems like the easiest approach would be to apply a "closest to" filter. I've attached a screenshot of a small portion of my workbook, which contains the equation for the "closest to" filter, a partial range of available resistor values, and the results for my filter. I have multiple tabs in my workbook.
I lied. I'm unable to post an image until I gain 10 reputation. I have 6 reputation. If you're reading this post and you're able to contribute to my reputation, please contribute.
This is my equation: =INDEX(A3:BZ26,MATCH(MIN(ABS(A3:BZ26-CB3)),ABS(A3:BZ26-CB3),0))
The equation format is: =INDEX(rng,MATCH(MIN(ABS(rng-value)),ABS(rng-value),0))
My formula seems to be correct but it returns "#VALUE!".

Picking top 5 scores from a range

I run a small golf eclectic with excel. One of the things we have is a points system. I would like to get the 5 highest points scored over the season and have them ranked from 1 (being the highest points scored) to 5.
My knowledge of excel "sums" goes only a wee bit further than add and subtract.
Thanks!
If you don't want to change the order that they are presently in you can use the LARGE function. It returns the kth largest value.
Below is a great formula, if you drag it down it will automatically get the second, third and nth largest value from a table of data (in this example the data is between A1 to A10).
=LARGE(A1:A10,ROW(A1)-ROW($A$1)+1)
You can then match the values with names or corresponding data from the tables using the MATCH and INDEX functions. The example below would fetch the name for each value from the second column.
=INDEX($A$1:$B$10,MATCH(cell reference with score or value,$A$1:$B$10,2))
Play around with these formulas, they are very convenient for data m
If you have a column containing the scores, you could add a filter (Data->Filter I think) and sort descending.
Though, if you just have rows that are something like [Date][Person][Score] you'll need to go to another sheet and SUM the scores for each person then sort that... Unfortunately my Excel skills aren't up to par to pull a score for each person like that.
Given a list of numbers in A1 to A10, you can work out their 'Rank' relative to each other by using 'RANK'.
e.g.
RANK(A1,A1:A6,0)
RANK(cell, list of cells to check against, order)
For order, 0 = descending.
From there you can work out which one is first pragmatically.
If you have Excel 2007,
Check that your data is continuous, with no blank rows or columns. Click on your scores and then select 'Data - Filter'
Using the dropdown that the filter creates at the top of your scores column and select 'Number filters - Top ten'
A 'Top ten Autofilter' dialog will be displayed, reduce the show 10 to 5 and then click on OK.
For earlier versions of Excel add a RANK formula in a new column. Be careful as the scores need to be sorted, usually into descending order. If there are any ties, they will be given the same ranking number and the subsequent rank number will be incremented by the number of ties. (E.g. If there are two scores of 2, ranked as 5. The next score will be ranked as 7, not 6)
If you want to use the LARGE Function as described above, make sure you put the same range in the list for each of the LARGE functions. That is, change =LARGE(A1:A10,ROW(A1)-ROW($A$1)+1) to =LARGE(A$1:A$10,ROW(A1)-ROW($A$1)+1) or you will get some strange incorrect results

Resources