What is the formula for weekstart and Weekend? - excel-formula

I'm literally spend so much time for lookig the right and accurate formula of them. I want to know what is the correct formula even if you double click the dot. It'll correct all

Related

how to paste excel formula correctly

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.

How to display mm:ss format not as a DateTime, without leading zero?

We have a spreadsheet at work, and we use it to keep track of various metrics, a few having to do with call lengths. The spreadsheet has been the same for years, but we now have a call time of 51:59 (mm:ss) which has broken the old format.
I am researching how to make it work as desired, and so far the best solution is to format the cell as [m]:ss and enter the time in the cell as 0:51:59. This gives the outcome desired, and performs all the calculations correctly, except I want to be able to achieve this without the leading zero. Ideally, someone could enter 51:59 into the cell, and it would read 51:59 and not 3119:00.
Does anyone know how to achieve what I am looking for? Any help would be greatly appreciated. I am comfortable with macros, so if there is a way to achieve this with a macro that would work, but ideally I am looking for a solution without a macro.
Thank you.
There is no way you can do this. The closest one is the following workaround:
Define cell A1 format as hh:mm and cell B1 format as mm:ss.
Enter formula =A1/60 into B1.
This will display 51:59 in B1 when you type 51:59 into A1.
Unfortunately, A1 text will read not-so-intuitive value after it loses the focus.
The workaround is described here:
https://superuser.com/a/235924

Excel adding unwanted cells to formula

I've been using Excel for quite a long time & I've never noticed this issue before. Someone at work asked me & I thought it must be a simple fix, but I'm stumped.
Let's start with A1:F1 being blanks, and G1 being =SUM(A1:C1) Pretty standard add the values. I only want G1 to sum the first 3 cells in Row1, even though there will be values in the others.
When I add values into cells A1:C1, no problem. As soon as I add a value to D1 the formula in G1 auto magically "fixes" itself to =SUM(A1:D1). Then a value in E1 changes the formula to =SUM(A1:E1). And so on... I need the formula to only sum A1:C1 regardles of the other values.
So I spent the usual 15-20 minutes looking all over the ribbons and options, and another 15-20 on the interwebs, but here I am. Hope it's not something stoopid that I missed and I feel like a dummy.
Winner Winner Chicken Dinner.
pnut solves it. "Uncheck Extend data range formats and formulas."
File> Options> Advanced > Uncheck Extend data range formats and formulas
Thank you.
I'm not sure if there is a way to do that, but you could just put =SUM(A1+B1+C1) in G1 instead and then it won't do that

Computing conditional SLOPE

I have a simple spreadsheet, where column A is a bunch of dates (ascending) and column B is a bunch of values. Finding the OLS slope is easy:
SLOPE(B2:B161,A2:A161)
But I don't want the slope of everything. I want to see the slope for each month. So if C3 is "3", I'd want to do something like:
SLOPE(IF(MONTH(A2:A161)==C3,B2:B161), A2:A161)
Which is wrong, but hopefully conveys what I'm trying to do. How do I actually do this?
You've got the right idea more or less. Try the following, but instead of just pressing enter to commit the value to the cell, press Control+Shift+Enter (CSE) which turns it into an array formula and makes it behave the way you'd like.
=SLOPE(IF(MONTH(A2:A161)=3,A2:A161),B2:B161)

Changing cell reference for a SUMIF criterion?

I'm trying to tell Excel to change the cell reference for a SUMIF formula based on the last cell that contains a value in each row. Right now, I know I could write a nested if statement to do this for me, but it's far too unwieldy to be a long-term solution.
Example:
On a separate report, every person in this list has multiple lines recording their daily sales. On a small scale, I'd simply write a SUMIF that uses for A2, B3 and C4 as criteria. The scale is much much larger, so my current solution is to write out a logic check with the SUMIF formula folded into it.
In this case, the formula in E2 would be:
=IF(C2="",if(B2="",SUMIF('range',A2,'range'),sumif('range',B2,'range')),sumif('range',C2,'range'))
Is there a different way to tell Excel to run the SUMIF with the last value found in each row?
I was hoping I could use COUNTA for each row, then have the SUMIF formula use the COUNTA value to change the criterion cell reference. I'm missing something here.
=SUMIF('range',INDEX(A2:C2,MATCH("zzzzz",A2:C2)),'range')
seems worth a try.
Edit Too long for a comment:
I don’t really have any idea how =MATCH() works but think of it as traversing left to right while searching. When it fails to find a match it just happens to have been looking at the last entry and (conveniently!) offers that up. So the key is to look for something that won't be found.
For people’s names I chose “zzzzz” as unlikely to be present. For numbers anything up to 9.99999999999999E+307 is theoretically possible and hence some people use that (eg an hour ago Formula to get the first cell with a numerical value from a selection?) but I prefer a googol (1E+100) and that seems quite large enough, is much shorter – and easier to remember, even if a few 9s more or less would make no difference, nor likely what couple of integers are after the +.

Resources