Excel query regarding IF statements - excel

I think this should be a fairly quick question, hopefully!
I would like to add a line to the following formula, after the line that says IF C6 =0,0 that if B6 is equal to W, the result should be 9.95:
=IF(C6=0,0,
MAX(SUM(IF(F6<=0,0,39),
IF(F6>30,(C6*0.08),
IF(F6>20,(C6*0.07),
IF(F6>10,(C6*0.06),
IF(F6>5,(C6*0.05),
IF(F6>2,(C6*0.04),
IF(F6>1,(C6*0.03),
IF(F6>=0.25,(C6*0.02),
IF(F6>=0,(0.03*C6*F6),0))))))))),43))
Basically, the first thing it should look for is that if C6 is 0, the result should be 0 - but if C6 > 0, then to check B6 for the letter 'W', and if that is true, then to display 9.95, otherwise to go along with the remainder of the formula.

Try this:-
=IF(C6=0,0,
IF(B6="W",9.95,
MAX(SUM(IF(F6<=0,0,39),
IF(F6>30,(C6*0.08),
IF(F6>20,(C6*0.07),
IF(F6>10,(C6*0.06),
IF(F6>5,(C6*0.05),
IF(F6>2,(C6*0.04),
IF(F6>1,(C6*0.03),
IF(F6>=0.25,(C6*0.02),
IF(F6>=0,(0.03*C6*F6),0))))))))),43)))

Related

How do I create the IF Statement in Excel which can handle many conditions. My Example provided

As you can see in my picture.
There is a table to the right.
Cell D3 has the option to select 90.0, 95.0, 99.0, and 99.9
Cell D4 is a % value
Cell D5 I have: IF(AND(D3=90,3/D4<9),3,4) Obviously if the user selects 90 for D3, then I want to determine which 2 X choices either 3 or 4 from the table are used based on the value of Y which I get by the 3/D4. This statement is working 100% correct.
MY QUESTION, How do I add the other parts of the table to this same line of code for when D3 = 95, 99, and 99.9?
I try this: =IF(OR(AND(D3=90, 3/D4<9),3,4, IF(AND(D3=95,4/D4<16),4,5)))
Try
=CHOOSE(MATCH(D3,{90,95,99,99.9},0),
IF(3/D4>= 9, 4,IF(3/D4>= 5,3,NA())),
IF(3/D4>=16, 5,IF(3/D4>= 7,4,NA())),
IF(3/D4>=20, 7,IF(3/D4>= 7,6,IF(3/D4>=6,5,NA()))),
IF(3/D4>=32,10,IF(3/D4>=15,9,IF(3/D4>=9,8,IF(3/D4>=8,7,NA()))))
)
In this formula MATCH(D3,{90,95,99,99.9},0) will return 1, 2, 3, or 4. This is used by CHOOSE to select the login in one of the four lines below.
Each of the next four lines is a nested IF statements. The question as asked has integer thresholds for 3/D4 and is a little ambiguous about things that fall in the gaps: for example, how do you handle C=90 and 3/D4=8.5. I've made the decision/assumption that when 3/D4<9, return 3. If that's wrong (for instance you want to round 3/D4 to an integer) you can modify the formula accordingly.
I've also made the decision to return NA when 3/D4 is below the lowest threshold. You can modify the formula to change that behavior too.

How can I constrain a cell sum from over adding from a given value

Sat down for a small project that's supposed to count combat details for my tabletop gaming sessions during lunch, turns out the excel code hates me.
C8 = CREATURE MAX HP
D8 = CREATURE CURRENT HP
E8 = CREATURE DAMAGE HEALED
F8:L8 = PC1:PC8 DAMAGE CAUSED
My formula for adding these together is contained in cell D8 and looks like this:
=C8-SUM(F8:L8)+E8
But I don't want my cell to add higher than what's contained in C8. How can I keep that from happening?
Does min work for you? =MIN(C8-SUM(F8:L8)+E8, C8) – Alexis Olson 8 mins ago
I'll go ahead an make this into an answer.
You can approach this in a couple of ways. The first is using MIN which takes the lesser of the two arguments.
=MIN(C8-SUM(F8:L8)+E8, C8)
You could also use an IF(test, result if true, result if false) function.
=IF(C8-SUM(F8:L8)+E8 > C8, C8, C8-SUM(F8:L8)+E8)
or equivalently, pulling the C8 value out, you have
=C8 + IF(E8 > SUM(F8:L8), 0, E8 - SUM(F8:L8))

Using the isnumber() function in Excel and Formatting Issue

I have a list of values, some being integers and some being non-integers. I would like to return the values that are integers. My idea:
if(ISNUMBER(C1)=TRUE,C1,0)
The data is laid out as so
88
Francesc Fabregas
m
86
Andrey Arshavin
a
86
Therefore I would only return the 88, 86, and 86. 88 is in cell C1.
Update: THE CELLS HAVE THE VALUES STORED IN THEM AS TEXT. HOW MIGHT I CHANGE ALL THE CELLS FORMATTING TO NUMBERS?
Try:
=IFERROR(--C1,"")
It will try to multiply -1*-1 to the value, if it is like a number it will return the number but if not it will error out and return "".
If you are using 2003 or later then use:
=IF(ISERR(--C1),"",--C1)
To do it in place highlight the range and you will see a little box in the upper left corner:
Hit that button and you will have a drop down list of option. Choose the "Convert to Number" option.
The NUBMERVALUE() function converts text to numbers. So the formula
=IF(ISNUMBER(NUMBERVALUE(D14)), NUMBERVALUE(D14), 0)
would turn your data to
88
0
0
86
0
0
86

Excel only identiy first argument in my formula

in my list of data, i either have 18 or 180 in cell A2 and I am trying to get cell A2 to multiply by B2.
My formula is:
=if(isnumber(search(18, A2)), A2*B2, if(isnumber(search(180, A2)), A2*B2,""))
However, when i do a find, it will only find 18 and not 180. How do I resolve this?
Kindly assist please.
Given what you want to do in your example I find this easier to read:
=IF(OR(18=A2;180=A2);A2*B2;"")
You probably wanted to do different things if you found 18 or 180. In that case you have to search for 180 first because the string "180" contains "18":
=IF(ISNUMBER(SEARCH(180; A2));-A2*B2; IF(ISNUMBER(SEARCH(18; A2)); A2*B2; ""))
This also finds 1802 2180, 218, 182, 0,18 etc.

How to add +1 to the last two digits of a number?

I want a way to do the following
Original Data I want result as
507-413-0109 507-413-0110
507-430-5409 507-430-5410
507-450-6649 507-450-6650
507-450-8640 507-450-8651
507-451-1563 507-451-1574
if the original number is 2133-2322 , I want it as 2133-2333 .
The last two digits should increase by value 1.
But , if there is a 9,
9+1 = 0
and
0+1 = 1
how to do it in Excel ?
You have to extract the 3rd column of numer (0109, 5409, ...) in a particular column. You can use the function RIGHT(A1,1) (where A1 is the cell which contains the 207-413-0109 string).
Then you just add +1 to them.
=REPLACE($A1,11,2,TEXT(IF(VALUE(RIGHT($A1)) = 9, MOD(VALUE(RIGHT($A1,2))+1,100), VALUE(RIGHT($A1,2))+11),"00"))
Put this in cell C1, then copy to C2 through C5.
I assumed that if the number ends in 99, then it replaces 99 with 00.
This will handle the 99 case as a 4-digit number instead of two, all other things being same:
=REPLACE($A1,9,4,TEXT(IF(VALUE(RIGHT($A1)) = 9, MOD(VALUE(RIGHT($A1,4))+1,10000), VALUE(RIGHT($A1,4))+11),"0000"))
So 1599 will become 1600 instead of 1500. And 9999 will just become 0000.
Assuming that your data begins in the "A1" spreadsheet position, if you put the folling formula in the "B1" cell, and then copy it downward, it should derive the values you're for which you're looking
=LEFT(A2,10) & RIGHT(TEXT(VALUE(RIGHT(A2,2)) + 1,"00"),2)

Resources