returning highest value with vlookup function - excel

i have this kind of dataset and i have to fill the "tot depth" column taking the highest value from each progressive (col K).
i've tried with ==VLOOKUP(N2,K1:L13841,2,0) but it gives me back the lowest value of the "P1" entry (-0.22).
the result i need would be :
Progressiva Tot depth
P1 -1.15
P2 -1.15
P3 -1.67

If you do not have MINIFS, you might try this in cell O2:
=MIN(INDIRECT("L"&MATCH(N2,K:K,0)&":L"&IF(N3="",COUNTAK:K),MATCH(N3,K:K,0)-1)))
And drag it to the end of the list. It will work as long as:
K column contains only the uninterrupted list of "progressiva" values;
H column contains the uninterrupted complete list of single occurences of "progressiva" value;
both column K and column N are sorted in the same way.

Related

Any ideas on how to turn certain cells absolute?

Here is my spread sheet:
What I'm trying to do is break down my total weight into individual weights, to do this I have to make total weight absolute so I can multiply my % ratios. Only problem is some skus have 6 items some have 5 items so I can't just set every X rows make absolute. essentially I want to do this.
P.S. I have about 5000 rows so it'd take a really long time to manually do it. Wondering if there's any solutions thanks.
You could use nested if functions, it's dirty but it works:
The function goes in J column
Check if the associate H column is empty
If it is empty return empty to keep the spreadsheet clean
If it is not empty check the row above in I column for empty
If it is not empty that the total weight to multiply the ratio by the total weight
If it is empty check the row above that
And repeat as necessary.
I wrote this function that checks 5 deep I think? You could keep nesting it to check 10 deep, 20 deep, etc., until you reach the nested IF limit in excel which I think is 255 so that it adapts to your varying needs in the items list.
=IF(H7<>"",IF(I6<>"",H7*I6,IF(I5<>"",H7*I5,IF(I4<>"",H7*I4,IF(I3<>"",H7*I3,IF(I2<>"",H7*I2))))), "")
Not sure if you just want the J column filled based on the H column, but here's my suggestion. I tend to use hidden columns as they keep my formulae simple but you can incorporate the formula in my G column (the column I'ld hide) into my formula in the F column.
Results Shown
Formulae Shown
P.S. I need reputation as I need to comment on another post.
Sryn
You could use a hidden column with nested If statements, formula goes in Column K:
Check if Column F is blank
If it is not check if the row above is blank
Repeat
Once the row is blank you know you are on the row with the total weight
Set the Column K cell to that value (the I column)
For column J:
If Column K is 0 then return empty
If not multiply Column H by Column K
The formula for Column K is:
=IF(F22 <> "", IF(F21 <> "", IF(F20 <> "", "", I20), I21)) - just add the required amount of nesting, for your case 6 nests is enough
The formula for Column J is:
=IF(K22 = 0, "", K22 * H22)
And then just right click column K and choose to hide that column. Of if you use column K in another part of your sheet just select any unused column.

How to get weighted sum depending on multipliers in column in Excel?

I have the table in Excel:
In column C (Sum) I want to get sum this way:
If in column A or B value is 1 then take Amount 48 and multiply by Multiplier (1) = 2.
If in column A or B value is 0 then take Amount 48 and multiply by Multiplier (0) = 1,5.
Then K1 and K2 summed.
So for row 2 the result in column C will be: 48*2 + 48*2 = 192.
For row 5 the result in column C will be: 48*1,5 + 48*2 = 168.
Is it possible to automate this process using Excel formula for C column (inspite of number of columns)?
Or you could use Countif (no shorter though)
=COUNTIF(A2:D2,0)*I$2*I$1+COUNTIF(A2:D2,1)*I$3*I$1
Use Ctrl+Alt+Enter when entering (since it's an array formula)
EDIT: I'm not great with formulas, so there is I'm sure a shorter alernative...

Median Selling Price Excel Table

I have a spreadsheet with different products, listing units and retail value sold like the example below
Product Units Value
A 10 100
B 15 80
C 30 560
I'd like to compare the Average Selling Price with the Median Selling price, so I am looking for a quick formula to accurately calculate the median.
The median function requires the entire series, so for Product A above I would need 10 instances of 10 etc. How can I calculate the Median quickly considering the condensed form of my data?
Without writing your own VBA function to do this there are a couple of approaches that can be taken.
The first expands the data from its compressed frequency count format to generate the full set of observations. This can be done manually or formulaically. On the assumption the latter is required, it can be achieved using a few columns.
All the blue cells are formulae.
Column Eis simply the cumulative of column B and F is an adjusted version of this. Column H is just the values 1 to 55, the total number of observations given by cell L2. Column I uses the MATCH() with its final argument as 1 to match each observation in H against the adjusted cumulative in F. Column J uses the INDEX() function to generate the value of the observation. (Observations 1-10 have value 100, 11-25 have value 80 and 26-55 have value 560 in this example). The MEDIAN() function is used in cell M2 with column J as its argument.
This approach can be refined to take account of varying numbers of products and data points through the use of the OFFSET function to control the range arguments of the MATCH(), INDEX() and MEDIAN functions. And, of course, adjacent cells in columns I and J could be combined using a single formula - I've shown them separately for ease of explanation.
The second approach involves sorting the data by value (so in this case the data rows would become Product B in row 2, product A in row 3 and product C left as-is in row 4). It is then a case of identifying the middle observation number (if the number of observations is odd) or the middle pair of observation numbers (if the number of observations is even) and then determining the value(s) corresponding to this/these middle observation(s). In this approach the adjusted cumulative in column F is still used but rather than explicitly calculating the values in column I and J for every observation it can now be restricted to just the middle observation(s).
I think there is no way around compromises. Either using big amounts of helper cells or having the table sorted by the values.
Helper cells:
Formula in F4:AS6:
=IF(COLUMN()<COLUMN($F$4)+$B4,$C4,"end")
Formula in D2:
=MEDIAN(F4:AS6)
Sorted:
Formula in F4 downwards:
=SUM($B$3:B3)+1
Formula in D2:
=SUM(LOOKUP(INT(SUM(B4:B6)/2+{0.5,1}),F4:F6,C4:C6))/2

How can I SUMIF where the IF evaluates whether a date is between two dates?

UPDATE: The contents of Column K were not, in fact, formatted as numbers all the way through.
Given:
Column F_____Column K_____Column M
3/1/2015_____1____________2/1/2015
2/1/2015_____2____________3/1/2015
2/1/2015_____3____________4/1/2015
where columns F and M are formatted as dates and K as numbers. Column F is not sorted, Column M is. Every date is for the 1st of its month.
I want to populate Column N such that each row sums the elements in column K whose corresponding value in Column F is in the month of Column M.
Tried:
SUMIF($F$2:$F$12500, AND(">="&M2, "<"&M3), $K$2:$K$12500)
Get zeroes across the board. Evaluating whether row 2 Column M and row 1 Column F are equal yields TRUE. What's going on?
With the assumption that all dates are the first of the month you don't have to restrict it to being in between the 2 dates on F:F but just rather that the dates has to match M2. With that in mind you can simply do the following:
N2 = SUMIF(F:F,M2,K:K)
This will add all the values in K:K for rows that have the same month (hence exact same date) as M2. Hope I interpreted your question correctly. Regards.

Excel - return value based on two inputs

I have two input values, that I want to use to return a third value.
Input 1: Y (lets say "Y" is in cell B1)
Input 2: 15 (15 in cell B2)
In another database sheet the input 1 values are sorted in the top row, the input 2 values are listed in a column in front of the wanted values.
| | X | Y | Z |
|16| a | g | k |
|15| b | h | l |
|14| c | i | l |
Fx. X,Y,Z are in row 3 and column 2,3,4.
I want a formula that returns "h" from the two inputs, Y & 15. How is this possible?
In your example above:
=INDIRECT(B1&B2) will return the value in [Y15] which is "h"
Assuming 16 is in Row4, please try:
=INDIRECT(CHAR(CODE(B1)-22)&6-MOD(B$2,14))
Here's a formula for you:
=INDEX(MatrixRange,MATCH(RowInput,MatrixStartColumn,0),MATCH(ColumnInput,MatrixStartRow,0))
MatrixRange = whatever the range of your data matrix is (in entirety) so if your data matrix starts in A3 and ends in D20 this would be replaced with A3:D20
RowInput = whatever cell you are getting search value for to find the row of appropriate data (This is Input 2 on your example)
MatrixStartColumn = Whatever column (or range) your Matrix data index starts in (these would be the numbers in your example). If the numbers on the left side of your data example are in Column A, this would be changed to A:A or A1:A50 (or wherever the last value is). The important thing for this is to use a range from the start of the column otherwise your row count will be off. If you must use a sub-range to avoid matches outside of the matrix, be sure to add the appropriate number to the end of the Match statement. For example if you are specifying MatrixStartColumn as "A3:A44", you will need to add +2 for the first 2 rows being skipped (A1 and A2). So the Index statement becomes (MatrixRange,MATCH(RowInput,MatrixStartColumn,0)+2,...
ColumnInput = whatever cell your column search value is in (your Input 1 data)
MatrixStartRow = Same as StartColumn above but for the header index of your matrix (the XYZ letters in your example). Just as above, if you must use only the range of the matrix, be sure to add your offset numbers so you get the right column.
Assuming that your inputs are at B1 (row), and B2 (Column) here is your formula:
=INDEX(B4:D6,MATCH(B1,A4:A6,0),MATCH(B2,B3:D3,0))
Here is how the formulas work:
INDEX(area with values, row , column) returns value based on row and column you provide.
MATCH(value to find, range to search) returns row/column where value was found.
Note that Match will accept only one row or column for 'range to search'.

Resources