I have the following data in excel. As you can see above each ArchID/ConopsID is linked to different FY and in each FY there are different tiers. I am trying to find a way where if tier is 1 or 2, the value stays the same. However, if you see ArchID = 700 only goes up to tier 3 whereas ArchID = 300 goes to tier 4. I want if an ArchID only goes up to tier 3, we take the value shown on tier 3 but if tier 4 is present, then we add up (sum) the value of tier 3 and 4 and insert that as the new value.
For example, for ArchID = 322, in FY 2022, the new value displayed in tier 3 should be 8 (2 + 6). Where as for ArchID = 700, in FY 2022, the value displayed in tier 3 would stay at 5 since there is no tier 4.
Please let me know how I can solve this.
Here is a bit of a lengthy function (given you've provided values that depend upon several requirements/fields - e.g. Arch/Conops,FY & Tier) that works:
=SUM(($F$4:$F$12)*($B$4:$B$12=B4)*($D$4:$D$12=D4)*($C$4:$C$12=C4)*(IF($E$4:$E$12>3,3,$E$4:$E$12)=MIN(E4,3)))
This assumes you want to return the same 'tier 3+4 sum' for tier 4 too -- else just reference E4 instead of min(E4,3) at the end of this function (which will return 0 instead), or simply put a big IF around whole function above (e.g. conceptually: IF(Tier>3, "n/a", function above) - but you can customize as req./desired).
Also - function above will actually sum numbers corresponding to any tier greater than 3 (5,6, ...) if these exist - assuming not an issue but if so modify above function as follows:
=SUM(($F$4:$F$12)*($B$4:$B$12=B4)*($D$4:$D$12=D4)*($C$4:$C$12=C4)*(IF(($E$4:$E$12>3)*($E$4:$E$12<5),3,$E$4:$E$12)= E4))
(being lazy by putting E4 at the end, which will return 0 for Tier 4, but you can customize using similar if statement in place of E4/cutomize per above as req.)
Related
I have an Excel document with multiple small tables in it. Here, each table describes a single project, and at the end of the worksheet, I want to create a summary that doesn't have "hardcoded" locations so that that when the amount of projects (tables) is adjusted, it doesn't break all the formulas. Basically, it looks like this:
A B
1 Project 1
2 Units 200
3 Price / Unit 10
4 Material / Unit 5
5 Handling / Unit 1
6 Total cost 6
7 Profit Margin / Unit 4
8
9 Project 2
10 Units 100
11 Price / Unit 5
12 Material / Unit 1
13 Handling / Unit 1
14 Total cost 2
15 Profit Margin / Unit 3
16
...
19 Summary
20 Units =SUMIF( A$1:A19 ; A20 ; B$1:B19 )
21 Material costs ???
22 Handling costs ???
23 Total Profit ???
Here, there may be an arbitrary amount of projects and I'm unsure how to create a formula that directly calculates the total material costs (and by the same pattern, Handling and Total Profit). For the total units, I can simply use a =SUMIF( A$1:A19 ; A20 ; B$1:B19 ) instead of =B2 + B2 by having the function search col A for the keyword "Units" but in order to do this for the total material costs, I need to multiply first. Eg, it would be =B2*B4 + B10*B12.
My first idea was to use an INDEX MATCH approach to extract a subarray from each table and then sum it all up using SUMPRODUCT however the MATCH function unfortunately only returns the first result and I can't get it to output an array of results (I think this is just a limitation with the function?).
I guess it would also be possible to simply add extra lines to each table to pre-calculate these products, but I don't like that solution as it would give the tables a lot of unnecessary extra bloat and I'd really like to solve this in one formula.
Any help would be greatly appreciated!
I came up with a dirty solution, using SUMPRODUCT formula that works if your using Office 365 :
example calculating total handling cost:
=SUMPRODUCT(FILTER(B:B,A:A="Units"),FILTER(B:B,A:A="Handling / Unit"))
FILTER(B:B,A:A="Units"), returns an array of values on the right of cells containing "Unit"
FILTER(B:B,A:A="Handling / Unit"), returns an array of values on the right of cells containing "Handling / Unit"
I have a price list in which customers will be charged different amounts according to how many products they order and if they are an existing customer.
I am trying to write a nested IF with AND statement with the following conditions:
Order 1-10 and TRUE = 3*1.2
Order 1-10 and FALSE = 3
Order 11-20 and TRUE = 2*1.2
Order 11-20 and FALSE = 2
Order 21 or more and TRUE = 1*1.2
Order 21 or more and FALSE = 1
So far I have a formula which works but is less than elegant where B1 is the order volume, B2 is existing customer and E1/F2/F3 are the prices.
=IF(AND(B1<11,B2=TRUE),E1*1.2,IF(AND(B1<11,B2=FALSE),E1,IF(AND(B1<21,B2=TRUE),F1*1.2,IF(AND(B1<21,B2=FALSE),F1,IF(AND(B1>=21,B2=TRUE),G1*1.2,G1)))))
Is there a way to make this formula more short/efficient?
You could separate it out a bit like:
=If(B2, 1.2, 1)*If(AND(B1>=1, B1<=10), 3, If(And(B1>=11,B1<=20), 2, 1))
If you convert this over to math you could just do:
=If(B2, 1.2, 1)*ROUND(30/CEILING(B1, 10), 0)
Or:
=(1+B2*0.2)*ROUND(30/CEILING(B1, 10), 0)
That's getting a little silly though.
Updated for the E1/F2/F3 difference. I didn't catch that the first time around. I think the following would be the way to go (kind of a mix of option 1 and option 3 above).
=(1+B2*0.2)*If(B1<=10),E1,If(B1<=20), F2, F3))
I think the biggest gain is seperating out the logic to determine your multiplier (1.2 vs 1 depending on B1) and the logic for determining the price (your If statement and E1/F2/F3)
I have a formula that currently works pretty well for the most part. It originally was a scoring factor of 90%-100= 5, and 85% to 89.99% = 4 and 80% to 84.99% = 3 and so on. This is represented using the formula below:
=IF($B10>=90%,5,IF($B10>=85%,4,IF($B10>=80%,3,IF($B10>=75%,2,IF($B10<=74.99%,1)))))
So the new requirement came down as follows:
Range value picture
95 to 100% = 5
85 to 89.99% or 101.1 to 105% = 4
80 to 89.99% or 105.1 to 110% = 3
75 to 79.99% or 110.1 to 115% = 2
Less than 74.9 = 1
So the dilemma I'm in is I have not been able to figure out how to create a range for values 2, 3 and 4 to be either or side for the scoring value to become true. So score value 4 should be the ranges of 85% through 89.99% OR 101.1% through 105% to be true.
Does anyone have any ideas on how to restructure this to include the ranges so that if either range is true it would show the correct scoring values? Thanks in advance for your help.
Instead of nested ifs consider using a table then use a VLOOKUP to find the correct value:
I created this table:
Then I can use this formula to get the proper score:
=VLOOKUP(B10,E:F,2,TRUE)
This method has the advantage of being able to easily expand to accomadate new rules. The only caveat is that your table must be sorted on the first column to get the proper return.
I have this table in Excel:
I am trying to get weighted sum depending on two conditions:
Whether it is Company 1 or Company 2 (shares quantity differ)
Whether column A (Company 1) and column B (Company 2) has 0 or 1 (multipliers differ)
Example:
Lets calculate weighted sum for row 2:
Sum = 2 (multiplier 1) * 50 (1 share price) * 3 (shares quantity for Company 1) +
+0.5 (multiplier 0) * 50 (1 share price) * 6 (shares quantity for Company 2) = 450
So, Sum for Row 2 = 450.
For now I am checking only for multipliers (1 or 0) using this code:
=COUNTIF(A2:B2,0)*$B$9*$B$8 + COUNTIF(A2:B2,1)*$B$9*$B$7
But it does not take into account the shares quantities for Company 1 or Company 2. I only multiply 1 share price with multipliers, but not with shares quantity).
How can I also check whether it is Company 1 or Company 2 in order to multiply by corresponding Shares quantity?
Upd:
Rasmus0607 gave a solution when there are only two companies:
=$B$9*$E$8*IF(A2=1;$B$7;$B$8)+$B$9*$E$9*IF(B2=1;$B$7;$B$8)
Tom Sharpe gave a more general solution (number of companies can be greater than 2)
I uploaded my Excel file to DropBox:
Excel file
I can offer a more general way of doing it with the benefit of hindsight that you can apply to more than two columns by altering the second CHOOSE statement:-
=SUM(CHOOSE(2-A2:B2,$B$7,$B$8)*CHOOSE(COLUMN(A:B),$E$8,$E$9))*$B$9
Unfortunately it's an array formula that you have to enter with CtrlShiftEnter. But it's a moot point whether or not it would be better just to use one of the other answers with some repetition and keep it simple.
You could also try this:-
=SUMPRODUCT(N(OFFSET($B$6,2-A2:B2,0)),N(OFFSET($E$7,COLUMN(A:B),0)))*$B$9
Here's how it would be for three companies
=SUM(CHOOSE(2-A2:C2,$B$7,$B$8)*CHOOSE(COLUMN(A:C),$F$8,$F$9,$F$10))*$B$9
(array formula) or
=SUMPRODUCT(N(OFFSET($B$6,2-A2:C2,0)),N(OFFSET($F$7,COLUMN(A:C),0)))*$B$9
=$B$9*$E$8*IF(A2=1;$B$7;$B$8)+$B$9*$E$9*IF(B2=1;$B$7;$B$8)
Since in the COUNTIF function, you don't know beforehand, which company column contains a 0, or a 1, I would suggest a longer, but more systematic solution using IF:
=$B$9*$E$8*IF(A2=1;2;0,5)+$B$9*$E$9*IF(B2=1;2;0,5)
This is a bit less general, but should produce the result you expect in this case.
Formula is to find the difference of multiples to be used in excel for an ordering form. For example, orders of items must be placed in multiples of 6, for every 6 ordered you get one free. So for 6 calculated result needs to display "1 item free". For 12 calculated result needs to show "2 items free". For 11 would need to display "Order 1 more, or 5 less".
How do I define this formula/calculation in an excel spreadsheet?
You want modular math:
e.g. 14 items purchased, buy in groups of 5:
14 mod 5 = 4
buy 1 more (5 - 4) or 4 less.