I made cell A1 equal 1.39139
Made cell B1 equal 1.40596
Made cell C1 a formula =(A1-B1)*10000
Copied cell C1 and pasted it by value into cell D1
In cell E1 I wrote manually the real result of the calculation, which is -145.7 (you can try using a calculator).
In cell F1 I made an if statement to compare the results of E1 and F1: =IF(E1=D1,"equal","not equal")
The result is "not equal".
**I want to know how to copy and paste a formula and make sure its pasted result will be exactly the same. keep in mind that I don't want to use =round() formula because I need a solution for many numbers, and I can't use round() for each cell with different number of digits.
As already pointed out, this is because of Excel's floating point precision.
You are correct that (1.39139-1.40596)*10000 is equal to -145.7. However, I tried typing this into Excel to see what it actually produced and I found the following. If you highlight your cell C1 and press F9 on the keyboard you will see that Excel actually computes this value as -145.700000000002.
I know you said you don't want to use ROUND but, aside from avoiding floating point numbers altogether (i.e. only using integers), I think ROUND is your only option.
I suggest that you determine what is the maximum number of digits after the decimal you will ever need in your sheet, and incorporate ROUND(<number>,<max digits>) into all formulas as necessary.
i.e. instead of using =(A1-B1)*10000, you should type =ROUND((A1-B1)*10000,5) (for example to round to 5 digits) which would return the value of exactly -145.7. I hope this helps, or if nothing else, I hope this at least shed light on what is causing this.
Related
I am a beginner to the Excel formula Please help to build the excel formula to sum the values in the rows (Z13:AC13) and from the result classify the value based on the below Classifications.
Unlikely: >=4<6
Possible: >=6<9
Likely: >=9<12
Certain: >=12<=16
I tried the below code but it is not working:
=IF(OR(SUM(Z13:AC13)>=4,SUM(Z13:AC13)<6),"Unlikely"),IF(OR(SUM(Z13:AC13)>=6,SUM(Z13:AC13)<9),"Possible"),IF(OR(SUM(Z13:AC13)>=9,SUM(Z13:AC13)<12),"Likely"),IF(OR(SUM(Z13:AC13)>=12,SUM(Z13:AC13)<=16),"Certain")
Try:
=CHOOSE(MATCH(SUM(Z13:AC13),{4,6,9,12}),"Unlikely","Possible","Likely","Certain")
Scott's answer is better, but if you'd rather have a more complicated formula that uses fewer Excel concepts, this worked for me:
=IF(AND(total>=4,total<6),"unlikely",IF(AND(total>=6,total<9),"possible",IF(AND(total>=9,total<12),"likely",IF(AND(total>=12,total<=16),"certain","---"))))
"---" is there in case the total is ever >16 by accident.
I gave the cell containing the sum the range name total to make the formula a little easier to read. If you don't like that, substitute SUM(Z13:AC13) for total.
I think the problem with your formula is the parenthesis after (for instance), the word "unlikely". It messes up the nesting. You don't want
IF(OR(SUM(Z13:AC13)>=4,SUM(Z13:AC13)<6),"Unlikely"),IF(OR...
you just want
IF(OR(SUM(Z13:AC13)>=4,SUM(Z13:AC13)<6),"Unlikely",IF(OR...
Simpler example showing the substitution of a whole second IF statement for condition-if-false:
=IF(criterion,condition-if-true,condition-if-false)
=IF(criterion,condition-if-true,IF(criterion,condition-if-true,condition-if-false))
Try it for practice:
Cell A1: blank cell for data
Cell B1: enter the formula =IF(A1="a","a",IF(A1="b","b","neither"))
Then enter a, b, or c into A1 to see what happens in B1.
A good tip is if you're having trouble with a formula, abandon your real data for a minute and make a dummy example that's as simple as possible. Get that to work, and then substitute your real conditions one step at a time.
Good morning, I am new at using excel and I'll be very thankful if someone can help (and I'm sure that the answer is easy from your point of view).
https://img15.hostingpics.net/pics/785039data.png
The screen capture reprents a simplified way of explaining what I am looking for:
For each number in the first column (which can appear more than once), I want to generate a corresponding Id (See column Id to affect which is the type of data).
We are only looking at the beginning of "Number", which can be up to 8 number is size.
Sometimes there can be tricky case, as te example starting with 40 vs 402 which are not affected to the same Id.
As I am new on excel maybe this answer or question exist but I don't know how to search/name it.
Thank you for your help, have a great day.
Tricky formula. Not exactly the prettiest thing ever but this formula works: (Line breaks added for readability)
= IFERROR(INDEX(D$2:D$7,MATCH(MAX((((A2-(C$2:C$7*10^(CEILING(LOG10(A2+1),1)
-CEILING(LOG10(C$2:C$7+1),1))))=MOD(A2,10^(CEILING(LOG10(A2+1),1)
-CEILING(LOG10(C$2:C$7+1),1))))+0)*C$2:C$7),C$2:C$7,0)),"(no match)")
A few things to note:
You didn't include cell ranges so you will have to manually change the cell ranges in the formula above to whatever your particular cell ranges are.
This is an array formula, meaning after you enter this formula into a cell, you must press on the keyboard Ctrl+Shift+Enter rather than just Enter.
The formula looks for the "strongest" match. For example, if a number is 40200000, the formula would return "Grapefruit" because it is a stronger match than "Grape".
If no match is found, I just have the formula return "(no match)" but you can obviously change that to whatever you want.
I assume this won't be an issue, but the formula will not work if any negative numbers are used.
See below, screenshot that shows formula works for your data.
You can try this array formula (click Ctrl + Shift + Enter together) from cell B2 and drag it down:
=IFERROR(INDEX(D$2:D$7,MATCH(MAX((VALUE(LEFT(A2,LEN($C$2:$C$7)))=$C$2:$C$7)*C$2:C$7),C$2:C$7,0)),"")
This will try to match the longest number (with MAX) and return the value (with INDEX/MATCH).
I was asking myself whether it is possible to add numbers to cell references which are used for formulas in Excel.
In my case I have the formula
=VAR.P('Excess Return'!E2:E22)
which obviously gives me the variance for the numbers ranging from E2 to E22.
Now I want to drag down the formula for all other cell and therefor i want something like
=VAR.P('Excess Return'!E2:E22+D3)
with the number 4 in the Cell D3 for example.
Now Excel should do
=VAR.P('Excess Return'!E2:E26)
but it doesn't and returns "#NAME?"
Any idea on how I can solve this problem?
Any help is greatly appreciated.
EDIT for clarification
My example wasn't really what I actually meant. Sorry for that.
So I have two columns with numbers E and F. In column G there is the formula.
G2 = VAR.P('Excess Return'!"E"&E2:"E"&F2)
E2 = 2
F2 = 22
which then should result in
G2 = =VAR.P('Excess Return'!E2:E22)
So I want to insert the numbers stored in column E and F into the cell reference for the variance function.
If the size of your referenced range is not supposed to change while dragging down, you can probably do what you want by properly using relative and absolute cell references
If you want to change your reference based on the value of another cell, however, you probably need an indirect reference.
Solving your example with INDIRECT():
=VAR.P(INDIRECT("'Excess Return'!E"&E2&":E"&F2))
Another way to reference indirectly - preferable because it is less volatile and causes less recalculations:
=VAR.P(INDEX('Excess Return'!E:E,E2):INDEX('Excess Return'!E:E,F2))
Thanks #DirkReichel for pointing out that alternative.
I have the following summation formula:
In text:
SUM (k*1.07^n), n=c1 to n=c2
k, c1 and c2 are 3 single numbers, specified in respective individual cells.
k is a constant, but c1 and c2 should be dynamically changeable.
Is that possible to do in Excel, and if so, how?
I know it's a fairly simple mathematical concept so I'd be surprised if Excel couldn't do it, but I haven't been able to find the formula myself. I've tried SUM and SUMIF, but from what I understand, that requires me to fill a whole range of cells each time I want to calculate something. I've also found some suggestions to use arrays in Excel, which I understand is automatically filling cells - which is at least a little more automated - but I'd rather not fill extra cells, if it's possible.
As a sidenote, I read Excel's accuracy is bad in high digit numbers, but as long as the first 5 digits are correct, it'll be accurate enough for my purpose.
With k, c1, and c2 in A1, B1 and C1 respectively, use the following formula:
=A1*SUMPRODUCT(1.07^ROW(INDIRECT(B1&":"&C1)))
Regards
I have an Excel file with over 5k+ rows and numbers.
I want to check these 5k+ numbers to see whether they have any "problems" within them (not errors such as #DIV/0, etc, those have already been accounted for).
So for example...a problem would be having a space in front of a number, causing that number to not be added to the sum of all numbers, etc... not logical errors, but more input errors. iserror would not work in this case, as it isn't a logical error.
Is there a way to do this automatically? Thanks!
Suppose all your numbers are in column A, starting at A1.
You could then in B1 put in the formula =Value(A1) and drag it down.
Then, just filter column B for #VALUE - That will give you all the numbers from column A that aren't seen by Excel as numeric.
Hope this helps!
On testing, Value() does its best to convert a value to a number, ignoring initial spaces or an apostrophe. I might use =ISNUMBER() in preference.
If you highlight the cells, say A2 downwards, you can create a Conditional Formatting, New Rule, Use a Formula, and enter =ISNUMBER(A2); choose some formatting for these cells.