Does Excel round up a number automatically? - excel

The value in cell A2 is 20.64907652 and I have put a formula in B2 which is =A2 but get the value in B2 as 20.65 and I cannot increase the decimals. Is =Round(A2,10) the only way? Thanks.

For number comparisons like this I like to show the explicit "rounding" that you're doing directly in the comprison, like so:
=If(ABS(A1-B2)<.02,"Close Enough","Not Equal")

there are two more formulas :
- =ROUNDUP(A2;2)
- =ROUNDDOWN(A2;2)
I hope this help.

Related

Excel CountIf IsFormula?

Is there a way to calculate the count of items in a range, that are a formula?
I'm only expecting =TEXT formulas, so I tried =COUNTIF(1:1, "=TEXT"), but that didn't work. Seems CountIf only operates with the displayed values of the cells.
If I have understood your post clearly, specifically you need those functions which starts TEXT() then perhaps you could try :
• Formula used in cell F6
=SUM(N(IFERROR(LEFT(FORMULATEXT(D6:D19),6)="=TEXT(",0)))
If you have the following in cells A1:A5
=TEXT("493","DDD")
555
=TEXT("420000","YYYY")
Yep
Nope
Either of these formulas should give a result of 2
Counts formulas
=SUMPRODUCT(--ISFORMULA(A:A))
Counts Cells with Formula Text
=SUMPRODUCT(--ISNUMBER(SEARCH("text(",FORMULATEXT(A:A))))

Trying to use indirect to make a formula dynamic

Ok, so I am trying to do something I thought was very simple, but it is turning out to be more complicated.
What I am trying to do:
Take a value through an if statement and return 1 or 0. But I want to be able to change the formula by changing values in cells and not editing the formula itself.
Example:
cell A1 = 41%
cell B1 = >
cell C1 = 40%
cell D1 = Formula with calculation
I want to create a formula that will tell me if that 41% is > than 40%, but if I change that > in B1 for a < (in a separate cell outside the cell with the formula) or I change C1 I want it to recalculate.
I have tried the following:
=IF(A1&B1&C1,1,0)
=IF(A1&INDIRECT(B1)&C1,1,0)
=IF(INDIRECT(A1)&INDIRECT(B1)&INDIRECT(C1),1,0)
all of these result in errors and I cannot figure out how to make it work. I am assuming it is taking the > and making it a string instead of a part of the formula.
Thanks for the help.
=COUNTIF( A1, B1&C1 )
... seems to do the trick, although converting C1 to text may give some rounding errors
An alternative would of course be to enumerate all the operations:
=--IFS( B1=">", A1>C1, B1="<", A1<C1 )
And add other operators as you come across them (NB the -- turns TRUE/FALSE into 1/0)

concatenate the cell value with result of If formula

I have the formula below which checks cell C6 and if C6="Yes", formula will return "X".
IF(C6="Yes","X","")
I now want this formula to concatenate the value of Cell C5 to string "X" only when the C6="Yes". How can I formulate this?
Thanks in advance!
Like this, using & to concatenate:
IF(C6="Yes","X"&C5,"")
As an addendum to Scott's answer, depending on your purpose you can also use CONCAT or TEXTJOIN. For instance:
=IF(C6="Yes",CONCAT("X",C5),"")
...or...
=IF(C6="Yes",TEXTJOIN(" ",TRUE,"X",C5),"")
If C5 is "example", these would result in "Xexample" and "X example", respectively. As Plutian mentioned, this is particularly useful if you're going to have more entries. TEXTJOIN is particularly useful if you're trying to make a sentence or concatenate an address separated by commas. It can also ignore blank cells, which can be handy.

Excel Substring

I'm trying to substring a date range,
Ex. 1/17/16-1/18/17 in Cell A1 to
1/17/16 in cell B1 and 1/18/17 to Cell B2
I have:
=LEFT(A1, FIND("-",A1)-1) Expecting 1/17/16
=RIGHT(A1, FIND("-",A1)+1) Expecting 1/18/17
But I get:
=LEFT(A1, FIND("-",A1)-1) results 1/17/16
=RIGHT(A1, FIND("-",A1)+1) Results 6-1/18/17
But for certain date ranges,
1/1/17-12/31/19 which is in A2
I get 1/1/17 in B2 and 12/31/19 in C2
The code is exactly same, except for the cell A2...
Can someone explain why this is happening?
In certain cases, my RIGHT brings back results like
17-5/28/17
as well...
Thanks in advance
=RIGHT(A1, LEN(A1)-FIND("-",A1))
Second parameter is [num_chars], so correct methodology is subtract LENGTH from POSITION OF '-'
What you're doing is providing the POSITION as a length.
Using Right can be painstaking. I prefer using Mid instead.
=LEFT(A1, FIND("-",A1)-1)
=MID(A1, (FIND("-",A1) +1), LEN(A1)-1)
=LEFT(A2, FIND("-",A2)-1)
=MID(A2, (FIND("-",A2) +1), LEN(A2)-1)

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