Microsoft Excel Formula If Then - excel-formula

I have a question that relates to if, then formula on Microsoft excel. Here is what I am trying to do but unable to write the correct formula:
IF(G2<=30000,"-g2*.003"))
If the column G2 is less than $30,000 then G2 x .003 will be subtracted. Otherwise, G2 x .002 will be subtracted.

=IF(G2<30000, G2-G2*0.003, G2-G2*0.002)
Mind you say "less than 30k" but have "less or equal 30k" in your proposed code...

A little unclear what exact result you are going for but try this:
=IF(G2<30000, G2 - (G2*0.003), G2 - (G2 *0.002))

Related

How to extract numbers with separation in Excel

Does anyone knows any formula to extract the number with separation (dot, comma) from cell A1 to cell B1?
Example, I want to extract 2,590.00 from cell A1 which has the following value:
[sum: 2,590.00]
I got the formula below that works nice, however is just getting all numbers e.g. 259000
{=TEXTJOIN("",TRUE,IFERROR((MID(A1,ROW(INDIRECT("1:"&LEN(A1))),1)*1),""))}
I appreciate every support
Under O365 you can try the following in cell B1 which is a very concise approach:
=TEXTAFTER(TEXTBEFORE(A1,"]"), "sum: ")
Here is the output:
For excel-2019, similar idea but using SUBSTITUTE instead to remove the prefix ([sum: ) and the suffix (]):
=SUBSTITUTE(SUBSTITUTE(A1,"[sum: ",""),"]","")
You can use a formula like as below:
• Formula used in cell B1
=MAX(IFERROR(--MID(SUBSTITUTE(A1,"]",""),ROW($ZZ1:INDEX($ZZ:$ZZ,LEN(A1))),LEN(A1)),0))
• With OFFICE 365, you can try this in cell C1
=--INDEX(TEXTSPLIT(A1,{":","[","]"},,1),,2)
• Formula used in cell D1
=SUBSTITUTE(TEXTAFTER(A1," "),"]","")*1

Why does a combined IF/ELSE/OR formula give "0" value in Excel?

=IF(C2<>"Online Store", G2=H2; IF(D2<>"SWEATERS", G2=H2, IF(OR(B2="Sept.", B2="Oct.", B2="Nov.", B2="Dec."), G2=H2*2, G2=H2)))
In Cell G2, place the below formula:
=IF(AND(C2="Online Stores";D2="Sweaters";OR(B2="Sept";B2="Oct";B2="Nov";B2="Dec")); H2*2; H2)
That way, you only check for the condition in which G2 becomes H2*2. That keeps the formula shorter, easier to understand, and easier to maintain.
in Cell G2, Place the below formula
=IF(C2<>"Online Stores"; H2; IF(D2<>"Sweaters";H2; IF(OR(B2="Sept";B2="Oct";B2="Nov";B2="Dec");H2*2;H2)))

How to write this nested IF function in Excel

I am trying to write the following function in Excel.
if P2 is greater than or equal to 3 and AD2 is 0
OR
if P2 is greater than or equal to 2 and AD2 is greater than or equal to 1
OR
if P2 is greater than or equal to 1 and AD2 is 2
Then do the following:
(H2+V2)/(P2+AD2),-999)
I have had a go at writing the following to no avail.
=IF(AND(P2>=3,AD2>=0),OR(AND(P2>=2,AD2>=1)),OR(AND(P2>=1,AD2>=2)),(H2+V2)/(P2+AD2),-999)
Any pointers in the right direction would be much appreciated as I am a novice at Excel functions.
Many thanks,
Ash
Erm...
I think this is right:
=IF(OR(AND(P2>=3,AD2=0),AND(P2>=2,AD2>=1),AND(P2>=1,AD2=2)),(H2+V2)/(P2+AD2),-999)
You need to nest your different AND conditions within a OR function...
Easiest way to do it, is to have your seperate functions in a cell each and build it up a step at a time, until you're sure it's right.. Then you can paste the function into one cell if required.
Say the below are in Cells A1, A2, A3
=AND(P2>=3,AD2=0)
=AND(P2>=2,AD2>=1)
=AND(P2>=1,AD2=2)
Then your total formula in a cell:
=IF(OR(A1,A2,A3),(H2+V2)/(P2+AD2),-999)
Try this one:
=IF(OR(
AND(P2>=3,AD2>=0),
AND(P2>=2,AD2>=1),
AND(P2>=1,AD2>=2)
),
(H2+V2)/(P2+AD2),-999)
it's slightly unclear from your question what'd be the correct
AND(P2>=3,AD2>=0) and AND(P2>=1,AD2>=2)
or
AND(P2>=3,AD2=0) and AND(P2>=1,AD2=2)
but you can easily modify this behaviour in the formula above.

EXCEL How do I ignore a cell if a cell has a value

I have a row that will have weekly values entered. Column B has the initial value, and E has the calculation; as I add values to C, D and so on, I want the calculation to skip the previous columns value when the next column gets a value.
B1-C1=E1 BUT when a value is added to D1, E1 would update to B1-D1=E1
Sorry for the horrible description. This is probably answered somewhere on this site but I am not sure what terms to search.
Many thanks!
you can use an if statement. I am not 100% sure of your problem but something like this might be helpful.
if(A1, A1, 0)
So for your example provided.
=B1-if(D1, D1, C1)
This says if there is a value in D1 use D1 else use C1. This works in this example, because if
D1 is empty or 0 you will use the other cell. This may change for any given problem.
Use this if function in E1:
=IF(D1>0,B1-D1,IF(C1>0,B1-C1,B1))
Then enter a value in B1, then C1 then D1 to see the results.
According to your question, you only have room for two entries after the default B1 value. This statement will handle that.
If you need more fields, nest more if functions. But if's can only be nested 7 deep, so you can only have an initial value in B1 and 7 more cells, C1 to I1 with your formula in J1
If you actual data is as simple as your sample data you could just use:
=IF(LEN(D2)>0, B2-D2,B2-C2)
You could also use:
=IF(ISBLANK(D2), B2-C2, B2-D2)
if you prefer but Len is a little shorter and I believe the ISBLANK() function has flaws, If you have a formula in D2 that has a calculation and you set the result to "" then it will pick up as false. It depends on your needs.
I would do the following.
In E1 paste the following:
=A1-INDEX(B1:D1,1,COUNT(B1:D1))
The count formula will tell how many values are present in the range of B:D column. This will be used to catch the last column with an index formula which will be deducted form A1.
One thing is very important! The values from A to D has to be written in sequence, if one column is missing than the calculation will be false.
Hope I could help!

Excel formula that multiplies the value of a cell times 2 only if it is under $.99

Hello and thank you for your help! I am writing a formula to help me calculate coupon deals for my shopping trip.
My store doubles coupons $.99 or under, so I need a formula that does the following:
If the value in cell D2 is less than $1.00, multiply the value by 2 and spit it out in D3.
I tried writing my own formula but it is not working, obviously :( =PRODUCT(IF(D2<"$1.00")D2 * 2)
Any ideas?
Somethign like this should do the trick, giving you the double amount if < $1, otherwise giving you the non-doubled amount.
=IF(D2<1, D2*2, D2)
("," might have to be ";" depending on Excel's whims and localisation settings :) )
Providing you have the value of the cells formatted with $ a the start, the following should work when entered into cell D3:
=IF((D2<"$1.00"),D2 * 2,D2)
If the cells are formatted as numbers to 2 d.p use the following:
=IF((D2<1.00),D2 * 2,D2)
Thanks

Resources