I have a range of articles;
Product Width height
6995851 2200 1500
6907240 2500 1500
6992008 2700 1500
6961925 2700 1500
6924509 3000 1500
6982492 3000 2000
And I have a number of models;
Product Width height Extra room Fits
9PARX 2470 1530 50
WGTQB 2970 1530 50
R3FEA 2970 1530 50
O03TU 2970 1530 50
7BUIT 3170 1530 50
H7XSB 3170 1530 50
NF75G 2970 1770 50
6X9EG 3470 1770 50
9Q9WJ 3470 1770 50
19UQR 4000 2100 50
FCQDM 3470 1770 50
I want the "Fits" in my number of models to tell me, with the added extra room, what article that is greater than that that will fit. Ie, Product "9PARX" would be a total of 2470+50=2820 wide and 1530+50=1580 tall, that means in tallness they all but "6982492" is valid, and in wideness "6992008" and "6961925" would be the ones that fit. Thus, in fits for "9PARX" the result will be "6992008" and, most desired in a second column, "6961925". Is it possible to make this with a formula? That way I can easily import [x] amount of models and update articles as time passes by and really easy know what fits best where.
Well, this can be done using Array formula, but it will be really slow.
Given that your second table (table with Extra Rooms) column Product starts in Column G and we start from row 2, then you can use the following formula:
=INDEX(A:C;MATCH(1;(B:B=MAX(IF(B:B<(H2+J2);B:B;"")))*(C:C=MAX(IF(C:C<(I2+J2);C:C;"")));0);1)
Some explanations:
MAX(IF(B:B<(H2+J2);B:B;""))
The formula above Sums Width + Extra and then tries to find the Maximum number which is less than the result (so that your product still fits in the room)
Our Match formula:
MATCH(1;(B:B=MAX(IF(B:B<(H2+J2);B:B;"")))*(C:C=MAX(IF(C:C<(I2+J2);C:C;"")));0)
This is multiple criteria Match function. We are looking for number 1 which is TRUE result for our Match criteria. Basically, we can have as many criterias here as we want where what we do is that we multiply results (either 1 for TRUE or 0 for FALSE) and if all conditions are TRUE then we have found our match).
Hope it helps!
Related
I'm looking to find a way to group/sort data based on a 2 serial numbers, in this case called Demand Number and Supply Number.
The logic I'm trying to apply is if an items supply number matches the demand number of another item then it should be shown underneath it for example if you were to sort the data shown below:
You would get the following result:
I think I will need to use some helper columns, to apply 'levels' to the items but I'm really not sure where to go.
Thanks for the help!!
Note if there is not way to achieve the sort as shown above, this sort would also be suitable:
Here is the data as text:
Item ID Demand Number Supply Number
Nut 10 1005 10055
Nut 10 10056 10087
Nut 10 1005 100585
Washer 40 10056 10095
Washer 40 1005 154899
Suspension 9 1001 1005
Engine 15 1001 10056
Car 66 18996 1001
I am looking for a way to do some type of lookup/match to come up
with bonuses. It is based on what they sold, for how much, and based on how much they sold last year, and the amount increased.
Example Line 2: So say they sold $900 worth of pens to Joe (New Amount is w/in 1-999). Last
year Joe only bought $23 worth of pens (Previous Amount is w/in 1-24) they get a $25 bonus (Bonus). Also..
There also has to be a minimum increase amount (Min increase column). So say if Joe bought
$999 worth of pens last year and $1000 worth of pens this year, the
salesperson shouldn't get a bonus because it was only a buck increase. It has to be at least $50 increase in this case. That's what the Min Increase column is.
Group Min Increase Previous Amount New Amount Bonus
Min Max Min Max
Pens 50 1 24 1000 999999 45
Pens 50 1 24 1 999 25
Pens 50 25 100 1000 999999 45
Pens 5 25 100 1 999 25
Paper 10 1 24 1000 999999 50
Paper 10 1 24 1 999 25
Paper 10 25 100 1000 999999 50
Paper 5 25 100 1 999 25
I started looking at Indexmatching but it's not enough. Then I thought of summing, but it's really not adding anything together.
=SUMIFS(B3:B10, G1:G10, "Pens", D3:D10, "50")
Also, =INDEX(range2,MATCH(TRUE,COUNTIF(range1,range2)>0,0)) won't work because that's only two ranges.
It also has to be something they can update constantly.
The actual data looks something like this
Sale Prev. Group
900 23 Pens
So you'd need to find the difference, see if it's within the minimum increase for the group and the amounts (900-23 > 50). Then return a value. 23 is between 1 and 24 and 900 is between 1 and 999 so $25 bonus.
Does anyone have any suggestions? I'm looking into index matching, but I can't find out how to do it with ranges.
Thanks
The formula is based on aggregate which performs array like operations. As such keep full column references inside of the aggregate function as short as you can and avoid full column references. Based on the layout of information in the picture above, place the following formula in L3 and copy down as required.
=IFERROR(INDEX(G:G,AGGREGATE(15,6,ROW($A$3:$A$10)/(($A$3:$A$10=$K3)*($C$3:$C$10<=$J3)*($D$3:$D$10>=$J3)*($E$3:$E$10<=$I3)*($F$3:$F$10>=$I3)*((I3-J3)>=$B$3:$B$10)),1)),"No Bonus")
Caveat: If for some reason, the sales situation matches multiple rows in your table, then it will return the bonus corresponding to the lowest row number that met all the criteria.
I have data in Excel in the following format:
Column A Column B
20/03/2018 300
21/03/2018 200
22/03/2018 100
23/03/2018 90
24/03/2018 300
25/03/2018 200
26/03/2018 100
27/03/2018 50
28/03/2018 90
29/03/2018 100
30/03/2018 110
31/03/2018 120
I would like to get the date where the minimum of B would never be under 99 again chronologically. It the example above, that would happen the 29th of March.
If I try to get it with: =INDEX(A:A,MATCH(99,B1:B12,-1)) the value returned is 22/03/2018 as it is the first occurrence found, searched from top to bottom.
In this case it would be perfect to be able to do a reverse match(e.g. a match that searches from bottom to top of the range) but this option is not available. I have seen that it is possible to do reverse matches with the lookup function but in that case I need to provide a value that is actually in my data set (99 would not work).
The workaround I have found is to add a third column like the following (with the minimum of the upcoming value of B going down) and index match on top it.
Column A Column B Column C
20/03/2018 300 50
21/03/2018 200 50
22/03/2018 100 50
23/03/2018 90 50
24/03/2018 300 50
25/03/2018 200 50
26/03/2018 100 50
27/03/2018 50 50
28/03/2018 90 90
29/03/2018 100 100
30/03/2018 110 110
31/03/2018 120 120
Is there a way of achieving this without a third column?
The AGGREGATE function is great for problems like these:
=AGGREGATE(14,4,(B2:B13<99)*A2:A13,1)+1
What are those numeric arguments?
14 tells the function to replicate a LARGE function
4 to ignore no values (this function can ignore error values and other things)
More info here. I checked it works below:
If your dates aren't always consecutive, you'll need to add a bit more to the function:
=INDEX(A1:A12,MATCH(AGGREGATE(14,6,(B1:B12<99)*A1:A12,1),A1:A12,0)+1)
=INDEX(A1:A12,LARGE(IF(B1:B12<=99,ROW(B1:B12)+1),1))
This is an array formula (Ctrl+Shift+Enter while still in the formula bar)
Builds an array of the row 1 below results that are less than or equal to 99. Large then returns the largest row number for index.
I have a column with ordinal values. I want to have another column that ranks them in equal groups (relatively to their value).
Example: If I have a score and I want to divide to 5 equal groups:
Score
100
90
80
70
60
50
40
30
20
10
What function do I use in the new column to get this eventually:
Score Group
100 5
90 5
80 4
70 4
60 3
50 3
40 2
30 2
20 1
10 1
Thanks! (I'm guessing the solution is somewhere in mod, row and count - but I couldn't find any good solution for this specific problem)
If you don't care about how the groups are split for groups that aren't evenly divisible, you can use this formula and drag down as far as necessary:
= FLOOR(5*(COUNTA(A:A)-COUNTA(INDEX(A:A,1):INDEX(A:A,ROW())))/COUNTA(A:A),1)+1
Possibly a more efficient solution exists, but this is the first way I thought to do it.
Obviously you'll have to change the references to the A column if you want it in a different column.
See below for working example.
How can I create a random number generator which calculates a random number based on a probability?
For example, I have the following numbers with the probability they will occur starting in cell A1 and B1:
100 5%
75 10%
50 42%
30 30%
15 5%
0 8%
Thus, the formula would "randomly" return the number "15" 5% of all times.
Slightly less overhead:
Make a reference chart of your values, and a running total of probability:
C D E
100 5% 0
75 10% 5%
50 42% 15%
30 30% 57%
15 5% 87%
0 8% 92%
Then lookup a 0-1 random number on this chart. =LOOKUP(RAND(),$E$2:$E$7,$C$2:$C$7)
I generated 5224 numbers and produced this pivot chart of the results. Refreshing caused the percentages to waver a bit around the targets, but all attempts looked good.
Row Labels Count Percentage Target
0 421 8.06% 8%
15 262 5.02% 5%
30 1608 30.78% 30%
50 2160 41.35% 42%
75 490 9.38% 10%
100 283 5.42% 5%
Grand Total 5224 100.00%
Or you could do it with two cells and a long if statement:
=RAND()
=IF(A9<0.05,100,IF(A9<0.15,75, ... 0))...
This functionality comes as part of the analysis toolkit add in. You can find this in Excel options -> add ins -> manage add ins.
You want random number generation, and then pick the 'discrete' distribution. The input into this is the table you provided in your post.
"Discrete
Characterized by a value and the associated probability range. The range
must contain two columns: The left column contains values, and the right
column contains probabilities associated with the value in that row. The sum
of the probabilities must be 1."
jsarma's suggestion is also a good one....
You can use vlookup and randbetween.
You'll want to use randbetween. http://office.microsoft.com/en-us/excel-help/randbetween-HP005209230.aspx
vlookup: http://office.microsoft.com/en-us/excel-help/vlookup-HP005209335.aspx
Fill one column with consecutive numbers ranging from 1-100.
Fill another column with 5 100's, 10 75's, 42 50's, etc...
Now...
=VLOOKUP(RANDBETWEEN(1,100),A1:B100,2)
There's probably a better way to do this, but I tried this and it seems to work.