IF formula not working - Trying to calculate correct shipping costs on items (Excel) - excel

I'm having problems trying to do this formula and it just doesn't work. Can anyone help me?
=IF(JH2="13",CEILING(JD2/0.68+13,0.5)-0.01,""),IF(AND(JH2="6.95",(JD2/0.68))<50,CEILING(JD2/0.68+3,0.5)-0.01,CEILING(JD2/0.68+6.95,0.5)-0.01),IF(AND(M2="CA",ISNUMBER(SEARCH(S2,"INCONTINENCE"))),CEILING(JD2/0.68+6.95,0.5)-0.01,""))
Just a FYI it reads,
IF Freight price is 13 THEN to Divide the Cost price by .68 and ADD the 13.
IF Freight price is 6.95 AND the Cost Price Divide .68 is LESS than $50 THEN add $3.00 ELSE ADD 6.95.
IF M2 (which is Unit of Measurement) has CA AND Column S2 (which is the category) contains the word "Incontinence" THEN calculate Cost Price Divide .68 and add 6.95 Regardless.
Everything is rounded up.
But can't get the Damn thing to work.

First some nagging and whining.
Unreadable source code.
Reference to cells without provided values.
Now the answer (at least a part of it, depending on me missing something else).
If you start breaking up the formula, you'll notice that the first AND has the condition of equality first (that's correct) but then you'll see that the second condition only is a division, whereas the inequality comparison with 50 is put outside.
I believe that's your error. But that's based on the assumption that I got the formula correctly.
As a general suggestion for working with complex formulas in Excel, I usually do a single step at a time (putting the sub-results in separate columns to verify that they're correct). When done and confirmed, I can merge them into a single one.

Try this, it is untested:
=IFERROR(CEILING(IF(JH2=13,JD2/0.68+13,IF(AND(JH2=6.95,JD2/0.68<50),JD2/0.68+3,IF(JH2=6.95,JD2/0.68+6.95,IF(AND(M2="CA",ISNUMBER(SEARCH("INCONTINENCE",S2))),JD2/0.68+6.95,"")))),0.5)-0.01,"")

Related

Using IF with ROUNDDOWN, To Calculate How Many Times For A Process

I apologize if the title is a bit vague. I am trying to create a calculator that takes into account how much "scrap" I have, how much is needed to resmelt it, and how many bars recieved.
Currently using:
(=if((amtOwned/qtyToSmelt)<1,,rounddown((amtOwned/qtyToSmelt)*barsMade))
Table and Formula
The problem I am having is you MUST have the QTY to Smelt. But the value returned includes partial quantities.
Ex. 125 Bottle Caps should equal 4 Bars total. Yet it returns 5.
How can i make the formula only account for increments of the bars recieved?
Thank you for any help, again i apologize if this isn't that clear. Im not exactly sure how to express my need in this situation.
I have tried messing around with the syntax and where every argument sits, even this formula is the most recent iteration of what i thought would be needed.
EDIT: I have tried using the TRUNC function and this seems to be working as I need it to. The formula now is:
=TRUNC((AMTowned/AMTneeded),0)*barsRecieved
=TRUNC((136/50),0)*2 This is returning 2 bars instead of 3. Which is exactly what I need.
It appears this is working by truncating the number first then multiplying it. So, 1.5 becomes 1 before being multiplied. This was my guess after doing more research. I had been searching for a while before I posted this but am glad to have learned what I have in searching for this.
There is a tool for auditing formulas. To see it go to Formulas > Evaluate Formula.
So here is you formula =IF((E3/C3)<1,,ROUNDDOWN((E3/C3)*D3,0))
Have you tried the calculation on your regular calculator? To me it is doing what you would expect. (125/50)*2 = 5

Negative time in Excel that isn't supposed to be negative

I'm trying to subtract 2 timepoints which excel is registering as negative when it shouldn't be. Time 1= 00:40 and Time 2=00:20 . Time 1- Time 2 should equal 00:20 but Excel seems to think this is a negative number. The formula I have is a bit more complex as it involves a Look Up function and I only have this problem on 2 of the lookup values (Other values are 00:45 and 01:00). Any thoughts would be much appreciated!
Thanks
I deleted one of the lookup values and it's registering the correct time now. Might be because one of the words in the lookup vector/value repeated itself (e.g. a in one cell and a b in a cell further down). I'm guessing Excel got confused? Although both result vectors in this case had the same time (00:20) so don't know what's going on there!

Excel Formula IF(AND #VALUE! Error

I am working on a financial model in excel. If the number of customers is between 1-10000, the cost is .20 per customer per month, 10000-100000 is .15 per customer per month, 100k and 1MIL is .10 per customer per month and > 1MIL is .08 per month per customer.
What I would like to do is create a formula where if the cell that references the number of customers at that month is within those values above, the cost per month changes depending on the number of cstomers.
This is what I have:
=IF(AND(B6>=1,B6<=10000),$Q$6), IF(AND(B6>10000,B6<=100000),$Q$7), IF(AND(B6>100000,B6<=1000000),$Q$8),IF(AND(B6>1000000),$Q$9)
Q6, Q7, Q8, Q9 are respectively: $.20, $.15, $.10, $.08
My B6 cell is the cell that is pulling over the number of customers from another sheet.
I am getting a #VALUE! Error when I use this formula. It works if I simply have:
=IF(AND(B6>=1,B6<=10000),$Q$6) which leads me to believe that my logic is wrong with all of the IF statements, and I should be using ELSEIF but I am not sure the syntax for that.
Help is appreciated!
So this is how I fixed this issue in case anyone had the same issue:
=IF(B6<=10000,$Q$6,IF(B6<=100000,$Q$7,IF(B6<1000000,$Q$7)))
By nesting the if statements with higher values excel automatically recognizes the max value for that if statement!
It seems that you are closing the IF statements too soon. Your formula repaired would look like,
=IF(AND(B6>=1,B6<=10000),$Q$6, IF(AND(B6>10000,B6<=100000), $Q$7, IF(AND(B6>100000,B6<=1000000), $Q$8, IF(AND(B6>1000000),$Q$9))))
If you start at the upper limit, you can reduce the conditions with sequential logic.
=IF(B6>1000000,$Q$9, IF(B6>100000, $Q$8, IF(B6>10000, $Q$7, IF(B6>=1,$Q$6, 0))))
You could probably do that a little more easily like this
=IF(B6>1000000,$Q$9,IF(B6>100000,$Q$8,IF(B6>10000,$Q$7,IF(B6>=1,$Q$6,"Error))))
You don't need AND because the IF functions are implicitly checking a range because the previous IFs rule out ranges of values

Microsoft Excel 2007 Always round up even if the decimal is under 0.5

So I'm creating a spreadsheet that determines the cost of materials and the number of each material needed in order to complete a desire project using input from myself. Right now the desired project is a wall that is 250x9 that requires replace all the 4x8 sheets of wood with OSB and install Vinyl Siding. The issue I'm running into is I cannot get it to always round up. By that I mean even if the value is 1.1 it should round up. In this specific case I am buying nails for my nail gun in a box of 2,000 and each sheet of OSB will have 32 nails in it. If 250x9 area requires 70.3125 sheets of OSB it means I still have to buy 71 sheets of OSB. If that OSB is 71 sheets then it require that I have 2272 Nails then the result is I need 1.125 Boxes of nails. However I can't seem to get it to show this as 2 boxes because again I still need to purchase more than one box to complete the project. So with that being said if I take the number of OSB needed 70.3125 and I place it in a formula with a roundup function it still rounds down (gives me a headache that there is a roundup and a rounddown function and it will still round down on me. Perhaps it is the way I am using it in the formula that is incorrect, I'm not sure. So let me translate the formula's used and you can let me know if I'm doing something wrong or if there is a function or set of functions that I can use to solve this issue.
=SUM(((B30*C30)+(B35*C35)+(E30*F30)+(H30*I30))/(E9*G9))
This says that if I added Wall1 L*W with Wall2 L*W with Wall3 L*W with Wall4 L*W and divide it by OSB H*W I get the number of sheets needed. Which in this case is 2250/32 basically. But its programmed in a manner that I can input the information for individual walls to different area's and get it to spit out the total SqFt for each wall and give an individual breakdown per wall of material needed with cost associated per sq ft of material bleh bleh bleh. The point is I take the result that is the 70.3125 and I move it to a different workbook and I say "Sheets OSB Needed" and in that box I have
=ROUNDUP(Sheet1!A9,1)
Whereas I'm asking it to roundup A9 which is the result of the above formula by intervals of 1. But the output is still 70 instead of 71. and much the same case with the nails needed. Which can be calculated in a few different manners but regardless the amount of nails needed divided by 2000 would output the decimal answer which yields a value of less than 1.5 and it too provides me with a value of 1 instead of 2 with much the same formula. I could achieve my desired result I suppose with Trunc and Mod functions collaborating using multiple cells to output the different portions of the data. But is there a way to do this that doesn't involve so many cells being used up?
C7
=Trunc(A9)
Removes Decimal from 70.3125
C8
=MOD(A9)
Outputs decimals from 70.3125
C9
=IF(C8<1,"1",C8)
If Decimals are < a whole number make it a whole number
C3
=SUM(C7+C9)
Add the whole number to the Trunc Number to get value desired.
Which I'm already seeing an issue with this if there is no decimals in the sheets needed then wouldn't it always add one because the decimal place would be 0? How can I handle this issue? Isn't there an easier way to do this or a way to code it so that its all nested into one calculation or at least mostly all into one calculation without making a circular reference of some sort?
You need to change the second parameter to a 0 ROUNDUP(70.3125, 1) is 70.3 the 3 must be getting dropped elsewhere or lost in formatting.
ROUNDUP(70.3125, 0) will give 71.
The second parameter of round up is the decimal place. So to round to integers it should be 0 not 1

How can I implement 'balanced' error spreading functionality in Excel?

I have a requirement in Excel to spread small; i.e. pennies, monetry rounding errors fairly across the members of my club.
The error arises when I deduct money from members; e.g. £30 divided between 21 members is £1.428571... requiring £1.43 to be deducted from each member, totalling £30.03, in order to hit the £30 target.
The approach that I want to take, continuing the above example, is to deduct £1.42 from each member, totalling £29.82, and then deduct the remaining £0.18 using an error spreading technique to randomly take an extra penny from 18 of the 21 members.
This immediately made me think of Reservoir Sampling, and I used the information here: Random selection,
to construct the test Excel spreadsheet here: https://www.dropbox.com/s/snbkldt6e8qkcco/ErrorSpreading.xls, on Dropbox, for you guys to play with...
The problem I have is that each row of this spreadsheet calculates the error distribution indepentently of every other row, and this causes some members to contribute more than their fair share of extra pennies.
What I am looking for is a modification to the Resevoir Sampling technique, or another balanced / 2 dimensional error spreading methodology that I'm not aware of, that will minimise the overall error between members across many 'error spreading' rows.
I think this is one of those challenging problems that has a huge number of other uses, so I'm hoping you geniuses have some good ideas!
Thanks for any insight you can share :)
Will
I found a solution. Not very elegant, through.
You have to use two matrix. In the first you get completely random number, chosen with =RANDOM() and in the second you choose the n greater value
Say that in F30 you have the first
=RANDOM()
cell.
(I have experimented with your sheet.)
Just copy a column of n (in your sheet 8) in column A)
In cell F52 you put:
=IF(RANK(F30,$F30:$Z30)<=$A52, 1, 0)
Until now, if you drag left and down the formulas, you have the same situation that is in your sheet (only less elegant und efficient).
But starting from the second row of random number you could compensate for the penny esbursed.
In cell F31 you put:
=RANDOM()-SUM(F$52:F52)*0.5
(pay attention to the $, each random number should have a correction basated on penny already spent.)
If the $ are ok you should be OK dragging formulas left and down. You could also parametrize the 0.5 and experiment with other values. With 0,5 I have a error factor (the equivalent of your cell AB24) between 1 and 2

Resources