excel calculation excess 1 on one file - excel

There is a file that contains mathematical operations that are a bit complicated.
When the file is opened on my laptop the value of 500,000,000 changes to 500,000,001, an excess of 1 number.
What exactly should I do?
I use Excel 2013, using an Asus X441U

This is commonly a formatting problem.
Please make sure that you are obtaining the real value of the result, not the displayed value.
This is best done by changing the cell number formatting. I would recommend adding a helper cell or two to and use =CELL("contents",yourcellwithchangingvalue) as one test.
Another method is to make a second result cell and wrap it in =TEXT(yourcellwithchangingvalue, "#.###") to see if that causes it to change.
Lastly, be sure all of your formulas are using functions or addins that are available on both machines.

Related

How to properly format dates in Google Sheets or Microsoft Excel

I have a spreadsheet I need to make in Google Sheets. The source of some of the data is exported to an Excel sheet. The data arrives in a dd/mm/yyyy format and I need to display it in a MON d format (Ex Sep 5).
The problem is both excel and sheets look at the date that arrives and think it is mm/dd/yyyy.
For example, 02/08/2022 is believed to be Febuary 8 even though it should be Aug 2. The problem then arises that neither of these platforms end up knowing how to convert this to Aug 2 and I end up having to do this manually.
Does anyone know how to get around this?
I have tried adjusting the format of the date, as well as using DateValue to convert (this fails since it understands the date as mm/dd/yyyy even when it is dd/mm/yyyy).
Any leads would be appreciated!
Thanks!
In Google Sheets, choose File > Settings > Locale and select a locale that uses the dd/mm/yyyy date format, before importing the data. You can then format the date column the way you prefer.
in gs:
=TEXT(REGEXREPLACE(A1&""; "(\d+)\/(\d+)\/(\d+)"; "$1/$1/$3"); "mmm d")
Try the following and format the result to your liking
=INDEX(IF(ISNUMBER(U2:U5),U2:U5,
IF(U2:U5=DATEVALUE("1899-12-30"),,
(MID(U2:U5,4,3)&LEFT(U2:U5,3)&RIGHT(U2:U5,4))*1)))
(Do adjust the formula according to your ranges and locale)
Functions used:
INDEX
IF
DATEVALUE
ISNUMBER
TRUNC
MID
LEFT
RIGHT
Well, for a formulaic solution, if the date is in A1, then the following places the correct date in B1:
=DATEVALUE(TEXT(A1,"DD/MM/YYYY"))
The TEXT function makes a string that will be the same form as your imported string out of the date produced during import. DATEVALUE then gives the proper date you desired.
The trick is in the TEXT step in which you reverse month and day in the string for DATEVALUE.
Naturally, instead of a helper column, it could just be wrapped around any reference to a date from column A, though one would have to remember to do so for all the years the spreadsheet is in use.
If you are importing, not just opening a .CSV file via File|Open and going from there, you have an opportunity to solve all your problems. You use the Ribbon menuing system's Data menu, select the very leftmost thing, Get Data and from the (no arguing THIS isn't a menu) menu that drops down, Legacy Wizards, then finally From Text (Legacy) which will open the old Excel Import Wizard. (You may notice this is very like the Data|Text to Columns Ribbon menu choice and that is because that choice is the old wizard minus the steps at the start that go looking to another file for the data because it knows, by law, that it has to already be in the spreadsheet... in other words, it looks the same because it IS the same.)
Then make selections for the first couple dialogs it presents you to get to the dialog in which you tell it to import columns as whatever: general (let Excel decide), text, date, and do not import. Choose Date and make the selection of DMY to import them properly as you desire them to be so you are never presented with the problem at all.
As you might guess, you can use the abbreviated wizard via the "Text to Columns" feature to do the same thing after import when you see they are reversed. Since it is a single column of data, the result will overwrite the original simplifying your work.
Why does this happen at all? Well, the "locale" folks have the idea. When Excel imports numbers that are in a form it recognizes could be a date, it looks to the operating system settings for the selected ways dates are understood. So if your operating system believes a date should be displayed "Month Day, Year" and Excel has a set of data it thinks fits that mold, it will convert them all using it. So you get those Feb 8's rather than Aug 2's.
Interestingly, it does two other things of note:
It looks at 8, count 'em, 8 rows of data to decide the data fits the pattern. Even with 1,000,000 rows to import, it looks at... 8.
Then it does them ALL as if God himself wrote the "8"... and dates like 25/03/2022 get imported as text not a real date, because they (oh, obviously) can't be dates... "25" can't be a month!
It IS possible to change settings (DEEP settings) to make Excel consider X number of rows in a data set before deciding such things. I found them here, on the internet, once upon a time, though I shouldn't like trying to find them again. It will consider up to a million rows in such an import, but... that'd make it pret-ty slow. And that's a million rows for EACH data column. I won't even say that "adds up" - I'll point out it "multiplies up."
Another technique is to add some number of starting rows to force the desired pattern onto the import. I've heard it works in TIME column imports so it ought to in DATE column imports but I've not verified such.
My bet is you will find the use of the "Text to Columns" feature of most use if you can use a hands-on approach - it does require literal action on your part, but is a fast operation. If you will see others using the spreadsheet though... well, you need a formulaic solution or a VBA one (macro with button for them to have some fun clicking as their reward for doing what they were trained to do instead of complaining to the boss you make bad spreadsheets). For a formulaic solution, the above formula is simple.
Last thought though: there's no error-checking and error-overcoming in it. So a date like "25/03/2022" in the data that imported as literal text is a problem. For handling the latter, an up-to-date approach could be:
=IF(TYPE(A1)=1,DATEVALUE(TEXT(A1,"dd/mm/yyyy")),DATE(INDEX(TEXTSPLIT(A1,"/"),1,3),INDEX(TEXTSPLIT(A1,"/"),1,2),INDEX(TEXTSPLIT(A1,"/"),1,1)))
in which the DATE(etc. portion handles finding text of the "25/03/2022" kind. Lots of less up-to-date ways to split the text Excel would have placed in the column, but since demonstrating what to do if it existed was the point, I took the easy way out. (Tried for a simple version but it wouldn't take INDEX(TEXTSPLIT(A1,"/"),1,{3,2,1}) from me for the input parameters to DATE.) TYPE will give a 1 if Excel imported a datum as a date (number), and a 2 if brought in as text. If empty or strange strings could exist, you'll need to deal with what those present you as well.

Excel formula named range changes - Jan 2020 update

UPDATE TO THE BELOW
The update has now rolled out to lots of machines, and broken maybe 90% of the work we have done in the past. Just to clarify exactly what I mean:
Using VBA (or C# or anything else for that matter) - we dynamically insert formulas at runtime using named ranges. For example:
=(MIN(Bid_S1,Bid_S2, Bid_S3, Bid_S4, Bid_S5)/Bid_S3)*PriceWeighting
This now longer works and gives a SPILL error. When I try to put the # in front as suggested, I see a message telling me # is not supported for some versions of Excel, do I still want to use it.
Option 1 - yes, I put #'s in front of every named range, spill error.
Option 2 - the formula they suggest is identical to the one I already had. Same Spill error.
This is going to be a huge problem for a lot of companies, surely.
Hard not to agree with this question:
https://answers.microsoft.com/en-us/msoffice/forum/all/the-new-dynamic-arrays-spill-functionality-should/92f9847f-deca-4ec9-ada3-9e005a5b68da?rtAction=1579696000111&page=1
A very bizarre situation. 4 different computers. Each running identical versions of Excel, Windows.
A simple named range with 4 cells say, called PlanID
PlanID
1
2
3
4
Type "=PlanID" next to the first, on 3 of the machines it returns 1, as I would expect. On the 4th machine it returns the formula array of the whole range. Just spent about 2 hours researching Spill errors etc but nothing seems to directly relate to the 2 issues I have:
How can something that has worked reliably for years suddenly not work
Why only on one machine?
Literally identical versions of Excel (16.0.12325.20280 32 bit)
Sound to me like your exisiting worksheets rely on Implicit Intersection (whether you realised it or not).
If that's the case, you can continue to use that, by preceeding your formula with # (See here )
If you create a workbook in a version of Excel that supports Dynamic Arrays, you will need to be explicit with your Implicit Inersections.
If you create a workbook in a version of Excel that does not support DA's, then later open it in a version that does, Excel will insert the #'s for you.
To illustrate, here's a book created in a version that does not support DA's
Here's the same workbook opened (without modification) in a version that does support DA's
Note the addition of #'s in the selected formula

Best way to create a process step diagram in Excel

Consider below set up:
Whenever you enter value under Time, it will be mapped on the right side under Process Time using the correct line legend depending on what column you enter your input.
I know my question would be a bit off topic or too broad, but I was hoping that someone may share their idea on how to accomplish the same other than VBA. I am currently doing this using Change_Event but this may be hard to maintain as steps may vary as well as the time intervals.
I also come-up with another solution using Conditional Formatting (same as the available template that Excel 2013 offers - Project Planner) but my customer wish to (as much as possible) preserve the legends.
So before I go on optimizing the current routine I've written, I want to consult on the communities opinion if I am on the right track on using brute force VBA (automating inserting and deleting lines) or if there is a simpler way. I just felt that maybe I am overdoing things (especially on the freeform line)
I had already a solution for this without VBA. But of course the legend symbols must be character glyphs. So they are not as flexible as you need. But maybe you get stimuli how programming this in VBA from this.
There is only one Formula in F4 copied cross down.
=IF(AND(SUM($B$3:$E3)<F$2,SUM($B$4:$E4)>=F$2),REPT(CHOOSE(MATCH(0,$B4:$E4,-1),"—","-","~","═"),4),"")
Row 3 must be empty. All times must be multiples of 10. And there is only one kind of process possible in each step. The cells F4:O10 must be formatted with a proportional font.

How to optimize COUNTIFS with very large data

I would like to create a report that look like this picture below.
My data has around 500,000 cells (it will continue to grow larger)
Right now, I'm using countifs function from excel but it takes a very long time to calculate. (cannot turnoff automatic calculate)
The main value is collected as date and the range of date is about 3 years, so I have to put a lot of formula to cover all range of value.
result
The picture below is the datasource the top one cannot be changed. , while the bottom is the one I created by myself (can change). I use weeknum to change date to week number.
data
Are there any better formula or any ways to make this file faster? Every kinds of suggestions are welcome!
I was thinking about using Pivot Table, but I don't know how to make pivot table from this kind of datasource.
PS. VBA is the last option.
You can download example file here: https://www.mediafire.com/?t21s8ngn9mlme2d
I will post this answer with the disclaimer that it is entirely dependent on the size of the data set. That turning on and off the auto calculate is the best way, but your question doesn't let me do that, so keep reading.
Your question made me curious, so I gave it a try and timed it. I essentially set up two columns of over 100,000 rand numbers choosing from 1-1000 and then tried to do a countif on the two columns if they were equal. I made a macro that I can run that turns off the autocalculate, inserts the start time, calculates, and then inserts the finish time. I highlighted in yellow the time difference.
First I tried your way, two criteria, countifs:
Then I tried to combine (concatenate) the two columns to see if I could make it easier by only having one countif criteria and data set. It doesn't. see result below:
Finally, realizing what was going on. I decided to make the criteria only match the FIRST value in the number to look for. I was essentially reducing the number of characters to check per cell. This had a positive result. See below:
Therefore my suggestion is to limit the length of the words you are comparing in anyway possible. You are mostly looking at dates, so you might have to get creative, but this seems to be the best way possible without going to manual calculation.
I have worked with Excel sheets of a similar size. Especially if you are using the data on a regular basis, I would heartily recommend switching to a proper database SQL based, Access, or whatever fits your purpose. I does wonders for the speed and also you won't run into the size limits of Excel. :-)
You can import the data you have now fairly easy.
I am happy as a clam with my postgresql db.

Speed up Excel formulas

Is there anyway to rewrite this formula to speed up Excel processing?
My spreadsheet has become terribly slow!
=SUMPRODUCT((Sheet1!J:J=Sheet2!A2)*(Sheet1!G:G="Windows XP")*(Sheet1!B:B="Desktop")*(Sheet1!M:M<>"Refresh >=Q2 2014")*(Sheet1!M:M<>"Release 2013")*(Sheet1!M:M<>"Release 2014")*(Sheet1!M:M<>"N/A NVM")*(Sheet1!M:M="No")*(Sheet1!M:M="N/A"))
As written your formula will always return zero because the last two conditions are mutually exclusive - did you mean those last two to be <> rather than = (or did you refer to the wrong columns)?
In any case I can see from the use of whole columns that you must be using Excel 2007 or later (your current formula would give an error otherwise) in which case COUNTIFS will be much faster, i.e. assuming the last two conditions should be adjusted as I suggested try this version:
=COUNTIFS(Sheet1!J:J,Sheet2!A2,Sheet1!G:G,"Windows XP",Sheet1!B:B,"Desktop",Sheet1!M:M,"<>Refresh >=Q2 2014",Sheet1!M:M,"<>Release 2013",Sheet1!M:M,"<>Release 2014",Sheet1!M:M,"<>N/A NVM",Sheet1!M:M,"<>No",Sheet1!M:M,"<>N/A")
If you do need to use SUMPRODUCT then restrict the ranges rather than using whole columns
I don't think that there is really a chance to speed up Excel Formula. But you could save your File in binary code (.xlsb). Losing some compatibility but improving performance.
You also could stop auto (re-)calculations of ther Formula, then you have to manualy refresh. This will let you edit the file much smoother.

Resources