Excel - stuck on simple point - excel

I am really lost on below table somehow and couldn't find a way to get out. I need to input one value to a cell and other cell needs to check, apart its fractions to get the result in a singe cell.
Can you please look up and assist me on this matter ?
Here are the conditions:
If value between; price;
0 – 1000 100
1001 – 2000 145
2001 – 3000 170
3001 – 4000 200
4001 – 5000 230
5001 – 7500 280
7501 – 10000 320
10001 – 20000 per 1000NT or fraction thereof 15
20001 – 30000per 1000NT or fraction thereof 10
30001 – 40000per 1000NT or fraction thereof 5
40001 – 50000per 1000NT or fraction thereof 5
Over 50001additionalper 1000NT or fraction thereof 5
My solution so far:
I8 CELL = =IF(E11>=10000;320;)
J8 CELL = =ROUNDUP(SUM(E11;-10000)/1000;0)
J9 CELL = =IF(AND(ROUNDUP(SUM(E11;-10000)/1000;0)>=1;ROUNDUP(SUM(E11;-10000)/1000;0)<=10);J8*75)
J10 CELL = =IF(AND(J8>=11;J8<=20);J8*65)

Related

Automatically add a number of row cells and subtract a 3rd row over a variable number of columns in Excel

I have the following function that automatically sums 3 rows together for a specified number of cells determined by D2:
=BYCOL((INDEX($1:$11,{4;5;10},SEQUENCE(1,D2,COLUMN(I:I)))),LAMBDA(x,SUM(x)))
The values in each column in rows 4 and 5 I wish to add together and I'd like to subtract the result from the cell value for row 10. I have a workaround which sets the values in row 10 to negative but I'd prefer them to be positive numbers.
I tried the following, but unfortunately it doesn't work:
=BYCOL((INDEX($1:$11,{4;5;10},SEQUENCE(1,D2,COLUMN(I:I)))),LAMBDA(x,y,z,SUM((x+y)-z)))
Example of expected result:
Jan
Feb
Mar
Apr
May
Jun
Jul
Aug
Sept
Revenue
10000
12000
14000
16000
11000
20000
21000
22000
24000
Extra Revenue
1000
2000
3000
1000
2000
2000
1000
1500
2500
Costs
500
1000
2000
500
1000
1000
750
1000
1000
Profit/Loss
10500
13000
15000
16500
12000
21000
21250
22500
25500
To make it match with your data:
=BYCOL((INDEX($1:$11,{2;3;4},SEQUENCE(1,Q2,COLUMN(B:B)))),LAMBDA(x,INDEX(x,1)+INDEX(x,2)-INDEX(x,3)))
where I've put a suitable value (9) into Q2.
EDIT
This would have been tidier
=BYCOL((INDEX($1:$11,{2;3;4},SEQUENCE(1,Q2,COLUMN(B:B)))),LAMBDA(x,SUMPRODUCT(x,{1;1;-1})))
Different approach - but in my eyes the formula is more readable for what you want to achieve:
The red part is named 'rowHeader', the blue part 'data'
=LET(revenue,FILTER(data,rowHeader="Revenue"),
extraRevenue,FILTER(data,rowHeader="extra Revenue"),
costs,FILTER(data,rowHeader="Costs"),
revenue + extraRevenue-costs)
UPDATE:
You can define the ranges also within the LET-formula
=LET(rowHeader,A6:A15,
data,MAKEARRAY(10,B2,LAMBDA(r,c,INDEX(6:15,r,c+1))),
revenue,FILTER(data,rowHeader="Revenue"),
extraRevenue,FILTER(data,rowHeader="extra Revenue"),
costs,FILTER(data,rowHeader="Costs"),
revenue+extraRevenue-costs)
B2 contains the number of months that should be returned.

Returning a value based on multiple criteria and ranges of numbers

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.

In Excel, how do I add values (running total) until and ONLY until a value is reached or breached?

Link to Google Sheet : https://docs.google.com/spreadsheets/d/1e6FWnOfwzSXr6DaDvdo7Ruw_4qy9C0YUmvJlEfoQLCU/edit?usp=sharing
What I need ? I have data in column A only. From A2 to A97. In B2, B3 etc etc, I want a formula that adds value in Column A from that particular Row and onwards until the value 100% is reached or breached. I found one formula (given below) for Count from elsewhere in Stackoverflow, but it works fine for certain rows and not others. ( this formula was suggested by the user #Jeeped )
=MAX(INDEX((SUBTOTAL(9,OFFSET(A2, 0,0,ROW($1:$99),1))<=100%)*ROW($1:$99),,))+1
( if i want to copy this formula down, in all the subsequent rows, will it work ? ).
Please help me with where I am going wrong. Thanks in advance !
100% ( should be reached or breached; then give output - Sum as well
as Count )
30% 8 Takes This and NEXT 7 rows to reach or breach 100%
-65% 7 Takes This and NEXT 6 rows to reach or breach 100% 30% 6 10% 5 10% 4
-27% 3 44% 2 198% 1 This is correct 250% 5 This is wrong. 240% is already greater than 100%. So the result should be "1".
-65% 11
-28% 8
-94% 6 125% 5 This is wrong. 128% is already greater than 100%. So the result should be "1".
-18% 5 75% 3
-99% 5 135% 1 44% 3
-8% 2 250% 1
-19% 18 This is wrong. It should be 5.
-78% 17 116% 16
-44% 15 183% 14 This is wrong 28% 17 4% 16
-84% 15 40% 14
-7% 13
-96% 12
-53% 9 163% 6 Wrong
-81% 9
-30% 6
-31% 5
-65% 2 237% 1
-57% 4 164% 3 Wrong
-87% 4 116% 1 62% 2 173% 30 53% 41 39% 100 Why 100 from here on ?
-6% 100
-51% 100 138% 38
-14% 100 259% 100
-51% 100 44% 100
-94% 100
-85% 100
-25% 100
-10% 100 104% 100 76% 100
-61% 100 86% 100 87% 100
-14% 100
-68% 100
-95% 100
-100% 100
-94% 100 75% 100
-78% 100
-92% 100
-78% 15 This should be 4
-78% 12 150% 1 150% 12
It seems that the formula you already have is very over complicated. If I understand your question correctly you want the totals in column B to continually increment until they hit 100% (or 1) then they just keep returning 1 thereafter.
This is simple to do. You simply put the calculation in an if statement with the condition is equal to or greater than 1 (because 1 == 100%) if the condition is true then return 1 otherwise return the result of the calculation.
There is an example sheet here (The formula in Google Sheets is the same as Excel in this case)
Otherwise in B2 you just need to take the value of A2 (as there is nothing to add it to at this point)
Then you put the following into B3 and copy it down:
=if(A3+B2 >=1, 1, A3+B2)
However a word of caution to the wise:
If you ever have negative values then this is not a good idea. Lets say you add 50% + 50% + 50% = 150% but in your case this will just = 100%. If we now add -25% the total is 75% instead of 125%
So just to be crystal clear, you should only use the above formula if you are certain that all the data in column A is going to be positive.

Find data between two values in excel

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!

Excel VBA Indicator Function for Macro

Suppose I have the following Data
Name Date Notional
Alice 10/1/2006& 1000
Bob 12/5/2011 5000
Dawn 1/1/2010 400
Alice 5/6/2009 500
Alice 7/13/2012 1500
Dawn 4/5/2012 100
I want to add two more columns, Total and Percentage. Where Total sums Notional per person and Percentage looks at a given Notional as a percentage of Total.
So Alice has three trades on three dates with three notionals of 1000, 500, and 1500. Her Total would be 3000 and her three percentages would be 33%, 16.6% and 50%
So my final result would be:
Name Date Notional Total Percentage
Alice 10/1/2006 1000 3000 33%
Bob 12/5/2011 5000 5000 100%
Dawn 1/1/2010 400 500 80%
Alice 5/6/2009 500 3000 16.67%
Alice 7/13/2012 1500 3000 50%
Dawn 4/5/2012 100 500 20%
I am hoping to write a Macro that adds an Sums the Notional for everyone provided the Name matches.
So my cell D2 will be C2 * Indicator(A2,A2) + C3 * Indicator(A3,A2) + C4*Indicator(A4,A2) + C5*Indicator(A5,A2) + C6*Indicator(A6=A2) + C7*Indicator(A7=A2)
Where Indicator(Ak,A2) is an indicator function which takes the value 1 when Range("Ak").Value=Range("A2").Value and zero otherwise.
Is there such a function? I suppose I can create one myself.
Public Function Indicator(c1 As Range, c2 As Range)
Dim out As Integer
If Range(c1).Value = Range(c2).Value Then
out = 1
Else: out = 0
End If
End Function
I am trying to get this to run inside a bigger code. But right now I am getting a lot of errors. I will update if I can get it to run.
I built a Pivot Table with:
Lines: Name | Date
Values: Notional [SUM] | Notional [% of parent row total]

Resources