Stop Excel from converting data value to decimal number - excel

When I try to concatenate a 2 cells, one of which contains a date, i'm getting a number with decimals. How to remove those decimals? From the below image, I want the output to look like Number:42952 but I get Number:42952.625. I don't see the decimals when I reference the cell though (see C2). How do I fix this?

try
=CONCATENATE(A1&INT(A2))
or replace INT with ROUNDUP if you want the next day

Related

Formatting a number with decimal places

I am trying to format a price that looks like this "193.250". I want to format it to "1.93250".
I've tried playing around with the format cells, but i can't seem to figure it out.
I don't think there's a custom format that will do that, but you could put this formula in a separate column
=A1/(10^(SEARCH(".",A1,1) - 2))
Of course, that will make 100.5 look like it has a greater value than 1000.5. The other option would just be to add a formula to divide by 100 and use the "Increase/Decrease Decimal" buttons to show the desired number of digits.

Unreasonably large negative number when using =NETWORKDAYS()

Hi there I am trying to use the =NETWORKDAYS formula in Excel to calculate the number of workdays passed between two dates minus public holidays on a separate sheet. When I enter the correct formula I get an unreasonably large negative number like -29221 workdays between 2017-04-28 to 2018-04-24. I've tried to change the NumberFormat of the cells, ignoring public holidays etc. but I still get these numbers. Am I doing something wrong?
Here's my formula:
=NETWORKDAYS(2018-4-24,D2,PUBLIC_HOLIDAYS!E44:E61)
Couldn't find anything on the internet that would solve this.
2018-4-24 probably isn't being read as a date value, insert it into a cell and change to general to get it's "value" or use it in Date() like so:
=NETWORKDAYS(DATE(2018,4,24),D2,PUBLIC_HOLIDAYS!E44:E61)
Static date is being read as text. Enclose it in quotes or use date function. Consider these options:
=NETWORKDAYS("2018-4-24",D2,PUBLIC_HOLIDAYS!E44:E61)
OR
=NETWORKDAYS(DATE(2018,4,24),D2,PUBLIC_HOLIDAYS!E44:E61)
If it still doesn't work, check the cells that you're referencing. Make sure you're referencing dates or its equivalent value and not some random numbers.
Hope this helps..

Change decimal number directly into hour in Excel

I need to convert lots of numbers that represent hours, into actual Excel values formatted like hours.
In e.g., I have a cell that has the value "16.30", and I need it to be "16:30".
I tried replacing the dot with two dots, formatting the cells with a custom format like "00:00" and "hh:mm", but nothing works. Excel returns an error or changes the value of the hour by converting the numeric value into an hour, as usual.
Any ideas about how to achieve the goal listed above?
TL;DR: how to change a cell with a value "16.30" into "16:30" as an hour?
Thanks in advance
One way to make your idea of substituting ":" for "." work is like this:
=TIMEVALUE(SUBSTITUTE(TEXT(A1,"0.00"),".",":"))
if A1 contains 16.3 and A2 contains the above and is formatted as time then it will display as time.
You can use this:
=TIME(INT(H6),(H6-INT(H6))*100,0)
Where H6 is your cell. Then format it as you want.

How do I add a zero after the decimal when coding in excel

I am having trouble adding a zero after the decimal when coding in excel. The number that is being output is 240 and I want it to say 240.0. I have tried the round function in excel however that is only working when I have something like 242.46 and it gaves me 242.5.
Try:
oWrkSheet.Cells(110, 17).NumberFormat = "0.0"
It can work for many other numeric formats. See this post for more informations.
You can use a formula:
=TEXT(A1,"0.0")
Either change A1 to the appropriate cell, or surround the cell in question with a =TEXT(...,"0.0")

Get Excel to display full values

I have an Excel spreadsheet with a range of values which are numbers that go to up 20 decimal places, unpivoted from another sheet using the trick from here.
The trouble is the cells are only displaying 10 digits so, for example, even though the value is 5.46827166811115 it is showing as 5.468271668.
I've tried setting the format to text but it still wants to treat it as a number, the number of decimal places varies so I can't use a fixed #.### format. The only way I can get it to show is to format the cells as text and to just select and then click in the entry box for each and every cell!
It then shows a warning that the number in the cell is formatted as text or preceded by an apostrophe but at least it's showing the full value.
I did find a VBA script that just did something stupidly simple like cell.Value = cell.Value for the selection which seemed to work but I can't find it anymore and I can't reproduce that now.
Surely there's an easier way to do this? It wouldn't matter so much but when I import this data through SSIS into a VARCHAR(MAX) it's getting the truncated values!
Pre-pend a single apostrophe ' to the data. In many cases, this is more effective than setting the cell format to text.
You could format the cell as text and the do an .AutoFit so the cell expands to show all the cell content, like this:
Columns("A:A").EntireColumn.AutoFit
that will expand the A:A cell so all its content is visible.
try formatting with #.000 instead of #.###, but if your problem is that Excel is dropping precision on you, you could try multiplying the value by 10^20, then dividing by 10^20 on the SQL side.
found more info:
here
looks like Excel is limited to 15 digits of precision, multiplying by 10^20 doesn't increase the precision, so you can treat it like text or split the remaining digits into another column and combine them back with SSIS or SQL.
Have you added the IMEX=1 to your connection string? That keeps SSIS from trying to figure out the data from the first few rows.
Also, what about using a decimal datatype instead of varchar(max)

Resources