Using ROUND after Nested IF Statements in Excel - excel

I am working on a spreadsheet for a client that calculates values and shows them as fractions after a good amount of deductions. We were running some test after I had it all set and ready and they ran a certain number through the spread sheet. I'll try to beak it down as easily as possible (any value with brackets is user input. So Width is [94.5(94 1/2)] that number get subtracted by 7.5312(7 17/32 that equals 86.9688(86 31/32) that number is then divided by [3] which then equals 28.9896(28 95/96) This is where the problem is though. 95/96 is not a "real" fraction is there a way I can round numbers like this down to 64ths? They were expecting 63/64ths Even though the math is correct they need it to round down in those cases.
The If statement is this:
=IF(E4=1,(K4-F19)/1,IF(E4=2,(K4-G19)/2,IF(E4=3,(K4-H19)/3,IF(E4=4,(K4-I19)/4,IF(E4=5,(K4-J19)/5,IF(E4=6,(K4-K19)/6,IF(E4=7,(K4-L19)/7,IF(E4=8,(K4-M19)/8,IF(E4=9,(K4-N19)/9,IF(E4=10,(K4-O19)/10,0))))))))))
This is a single part of the IF statement:
=IF(E4=1,(K4-F19)/1
Is there a way around this or are they SOL(Sorta Outta Luck)?
Thanks for any insight.

Assuming in A1, please try:
=ROUNDDOWN(A1*64,0)/64
with suitable formatting.
This ensures that all results are multiples of 1/64.

Related

Excel percentage increase based on formula

I am trying to fill the sell price column in an Excel spreadsheet with the increased values in colors based on the round up columns value (1 to 50 green, 50 to 100 blue, 100 to 150 yellow, 150+ pink).
I've opted for the percentage table because some items can be sold for a lot more than what I have purchased them for, so that's just for my benefit. I am open to any other suggestions and I am new to this whole business thing.
I was using IF in my formula which would work great for using one percentage increase in the formula:
=IF($E27<50,ROUNDUP(I$27,-1))
If I try to enter a second argument like
=IF(OR($E28<50,ROUNDUP(I$28,-1)OR($E28>50,<100,ROUNDUP(J$28,-1))))
I will get an error.
I'm probably using the formulas wrong, I've tried "AND" and a couple other formulas, but I can't find anyone else trying to achieve the same or similar.
So something like this:
=IF($E28<50,ROUNDUP(I$28,-1),IF($E28>50,ROUNDUP(J$28,-1),"Error"))
But not sure what the <100 was for.
Although the problem is not completely clear, I understand that you want to add a formula with nested if statements.
I will recommend you to try nested ifs in parts.
=IF($E27<50,ROUNDUP(I$27,-1),"First if condition is false")
If everything is working as per the requirement then edit that text in the formula to add another if statement.
=IF($E27<50,ROUNDUP(I$27,-1),IF(OR(condition 1, condition 2,more conditions),"value if true","value if false"))
In the second argument provided by you, the arguments of the OR function has not been properly provided. Ensure that all the arguments of an OR function are conditions separated by a comma.
$E28<50 This is a condition so it's ok.
But other arguments are not making sense.
Also, using OR multiple times inside the first OR arguments is not clear.
It would be beneficial if you could provide the basic table and mention the requirement clearly.

Dynamic value lookup if input is between two set values

A table contains a list of number and a list of starting values for when the numbers are valid. A separate table has a list of inputs for which the output must be calculated.
Calculation rules:
If the input is greater than or equal to the lower of two sequential start values and less than the higher of the same two start values, the number corresponding with the lower start value is valid.
If the input is lower than the first start value, the output is 0.
If the input is greater than or equal to the highest start value, the output is the number corresponding to the highest start value.
The values in the Number and Start fields are dynamic. In other words, the values can't be hard coded.
Start values will always be in ascending order.
For example:
The following formula works, but I'm trying to increase my Excel skills by considering options which would shorten the overall number of characters. I suppose it's a little bit of a Code Golf situation.
=IF(D2<B$2, 0,
IF(D2<=B$3, A$2,
IF(D2<=B$4, A$3,
IF(D2<=B$5, A$4,
IF(D2<=B$6, A$5, A$6)
)
)
)
)
My current solution doesn't scale well because of the nature of embedded if statements. The goal is to reduce the number of characters necessary to compute the right output values with no concern for readability. It's okay to create reference cells if necessary, but I've been trying to avoid that.
This a dive into nitty-gritty algorithms more than anything else. Any tips would be greatly appreciated.
I found a more succinct and readable answer after considerable trial and error. Unfortunately, I had to add another field (Stop), but the resulting formula is much more readable and idiomatic. See below.
This is the formula in F2: =SUM(J4>=C$11:C$15*(J4<E$11:E$15)*F$11:F$15)

Excel if formula possibility

I have an issue that I don't personally know how to format. I need to subtract numbers that are in seconds, formatted to be viewed as 58.43 or 59.99, but that are sometimes in minutes, formatted as 1:01.33 for example.
I would also need to be able to subtract the numbers from each other to be recognized as (+1.08) or (-0.78), with the parentheses.
I'm sure I can elaborate somewhere, so let me know if this doesn't make any sense. Thanks
It depends if 58.43 is formatted as a number or time. Date and time are stored in number of days, so the time 58.43 is actually stored as the number 0.00067627314814814800000 (58.43/24/60/60).
If both values are time values, then the custom number format of the result can be:
(+s.00);(-s.00);(0.00);#
To handle both cases, instead of =A1-A2 you can try this something like this:
=IF(A1<1,A1,A1/86400)-IF(A2<1,A2,A2/86400)
If those are just time values formatted as mm.ss then you can use TIMEDIFF()
https://support.office.com/en-us/article/Calculate-the-difference-between-two-times-e1c78778-749b-49a3-b13e-737715505ff6
If not, try to convert them to time values and than use TIMEDIFF()
The first part is straightforward
Apply a default format of
ss:00
Then in conditional formatting use a formula
=A2>=TIME(0,1,0)
and apply a format of
m:ss.00
for the ones that are a minute or more.
There is no direct solution to the problem of displaying negative times short of changing the default date system used by Excel as you can see in a number of references. The only way to do it here is to test whether the result is positive or negative and display the positive difference with or without a minus sign.
=IF(B2>=A2,TEXT(B2-A2,"(+s.00)"),TEXT(A2-B2,"(-s.00)"))
The downside of this is that they are actually text values and you can't use them in any further calculations. However the results of A2-B2 are still good even if you can't display them directly, so you can use A2-B2 in subsequent formulae if you want to even if it is negative.

Excel formula score and award a place - Rank based on multiple parameters

Let me share the problem, where I am trying to decide the winner list comparing multiple parameters:
First of all, I need to compare the fault points. The less you have the better place you get. If the fault points are equal, then I need to compare the time. Comparing the time, the faster you performed the greater place you get (green column represents the right result).
I have used this formula:
=IF(AA16="";"";COUNTIF($Z$16:$Z$24;"<"&Z16)+1+SUMPRODUCT(--($Z$16:$Z$24=Z16);--($AA$16:$AA$24>AA16)))
However, I get a wrong comparison for the time parameter. My guess is that it is either a small issue I am having or the formula itself is completely wrong.
Thanks in advance.
Use this formula instead:
=RANK(Z16,Z$16:Z$24,1)+SUMPRODUCT((Z$16:Z$24=Z16)*(AA$16:AA$24<AA16))
See image for reference:
Looks like this might be helpful. They have an example related to breaking ties that I think will work for your scenario.
Excel Functions: Rank

Trying to show only a certain amount of numbers

To make the sale to my customer I need to import numbers from a report into an Excel document. For example the number coming in will be 14.182392. The only reason for my guy not to buy the product is because he only wants to view 14.182 on the Excel sheet. Okay so the other catch is, the number CANNOT be rounded in any shape or form.
So what I need is a way to just show so much of number, WITHOUT ROUNDING.
Is this possible? Any ideas of how I could get around this would be fantastic.
Please try:
=TEXT(INT(A1)+VALUE(LEFT(MOD(A1,1),5)),"00.000")
Firstly =TRUNC is a better answer (much shorter). My version was connected with uncertainty in your requirement (it is odd!) and in the hope it might be easier to adjust if not exactly what you/your boss wanted.
TRUNC literally just truncates the decimals (no rounding!) to a length to suit (ie 3 if to show nn.182 given nn.182392 or say nn.182999).
LEFT may also be a better choice, but that depends upon knowing how large the integer part of your number is. =LEFT(A1,6) would display 14.189 given say 14.189999 in A1. However it would show 1.4189 given 1.4189999 in A1 (ie four decimal places).
The formula above combines text manipulation with number manipulation.:
INT takes just the integer value (here 14.)
MOD takes just the modulus – the residual that is not an integer after division, in this case by 1. So just the .182392 part. LEFT is then applied here in a similar way to as used above, but without needing to concern oneself with the length of the integer part of the source value (ie 14 or 1 etc does not matter).
VALUE then converts the result back into numeric format (string manipulation functions such as LEFT always return text format) so our abbreviated decimal string can then be added to our integer.
Finally, the TEXT part is for formatting but is hard or impossible to justify! About the only use is that it displays the result left-justified in the cell – perhaps a little warning that the number displayed is not the “true” value (eg it won’t SUM) because, as a result of a formula, it won’t be marked with a little green warning triangle.
The displayed values can use the TRUNC function like this,
=TRUNC(A1, 3)
But you must use A1 in any calculations to retain the precision of the raw value.
Easiest way I know:
=LEFT(A1; x)
where x = the amount of characters You want. Mind that the dot counts as a character as well.

Resources