I have had this problem forever and never managed to figure it out.
I am importing an excel (.xls) file into an asp recordset. Most of the time this works great.
I have column with the following values
4
4
5,6
3
Asp reads those values in except for the 5,6. I have tried formatting the cells and this makes no difference. It appears that asp (or excel) are trying to determine the type of the cell by examining the value. For whatever reason it then throws this hiccup if some of the cells aren't the same format as the majority of the other are.
The problem is that ADO scans the first 8 rows and based on the data it finds in each column it sets the column type. So if your first 8 rows contain numbers then it sets that column to numeric and returns null for any other values, for example if the ninth row contains text or a comma. See http://blog.lab49.com/archives/196 for some suggestions on how to avoid this.
Have you tried setting the 5,6 to 5.6?
Try adding IMEX=1 to your connection string.
If that doesn't fix it, then try changing the following registry key value:
HKLM/Software/Microsoft/Jet/4.0/Engines/Excel/
"TypeGuessRows"=dword:00000000
If you have a 64-bit system the registry key will be at:
HKLM/Software/Wow6432node/Microsoft/Jet/4.0/Engines/Excel/
"TypeGuessRows"=dword:00000000
Related
So I have a list of country codes for records which I am trying to convert to country names in my spreadsheet. I created a lookup table on a separate tab, and used the formula: =VLOOKUP(F31,'Country Code Lookup'!C1:D249,2,FALSE)
Then I dragged the formula down the column to fill in the data. Everything was working but then I noticed that some cells were giving me N/A... even when the data had been correctly been found at an earlier point in the column (see attached graphic).
As you can see, it already found Finland earlier in the table, but yielded an N/A later. I tried this on both Excel and Libre Office Calc btw, and it came up with the same errors. The country codes were TRIMmed from another column to remove spaces that were in there, so I thought there might be an issue with hidden characters or something, so I deleted FI in the second instance, and put it in manually to see if that fixed the issue. Nope. Also deleted the value from the lookup table and manually reentered... same result. So now I am at a loss as to what to do, as this error is popping up all over the place and my spreadsheet is over 1000 rows long, so I don't want to be manually correcting the errors. Can anyone provide some insight on how I might solve this?
I am working with an excel file and I am trying to "map" some values with the vLookUp function.
The first parameter of the vLookUp function is giving me headaches: The function works with certains values (typed by hand in a text format)...but doesnt work with pre-generated values (the sames ones...but generated from an ERP system..). I checked to make sure that I was looking for "same nature" values ( text vs text ) ...but I can't find out why the first 3 values (typed by hand) are fine... but the last 3 (pre generated) gives me a #N/A error: It has to be a difference of "format" ..but I can't find out where's the difference...
This is the formula used: =VLOOKUP(D1;$A$1:$B$219;2;FALSE)
The actual file
1008600 379.99 1008600 379.99
1008601 379.99 1008601 379.99
1010600 449.99 1010600 449.99
1010601 449.99 1010601 #N/A
1013600 489.99 1013600 #N/A
1014601 509.99 1014601 #N/A
1015600 569.99
1018603 679.99
1019600 809.99
Thank you !
Using this formula will address the issue highlighted by RocketDonkey
=VLOOKUP(TEXT(D1,"#"),$A$1:$B$219,2,FALSE)
The issue is that you haven't converted you values in column A to numbers. Since the first three values in your lookup range are themselves strings, they are matching the stringified numbers.
In order to fix, click on one of the numbers in column A, press Ctrl+Space to select the entire column, and then click on the exclamation mark and select Convert to number:
After that, you'll notice that your previous values now show errors, so follow the same process to conver them to numbers as well. #nutsch's solution is does not require you to modify your data, so if the type of your data is not crucial, that is a good fix as well :)
This has been a major pain for me as well(Excel is full of stupid assumptions). What I do is copy the entire column to a text editor, change the column to match the lookup column, and copy and paste the data back into the column. This has worked well for me.
May I highlight the little noticeable reply that Barry Houdini came with in 2012 above:
=VLOOKUP(D1&"",$A$1:$B$219,2,FALSE)
that really works (for me in Excel 2010), despite you are dealing with Numbers or a mix of Numbers or Text strings.
Cudos to Barry, you are a truely Houdini
Hey guys I have a situation where I need to format a column to display APR(%) values in a certain way. Basically the values should be formatted like below:
Raw input Formatted value
========= ===============
0 0
0.0 0
4.4566 4.5
5.00 5
6 6
6.4 6.4
I tried creating this formula below but for some reason it doesn't round the number to 2 decimal places.
=INT(ROUND(A1,1)*100)/100
What am I doing wrong? Or is there a better way to handle this?
UPDATE: So I am applying the function to the same cell as the number is in. For instance the A1 cell contains 4.566 value and I applied the function to that same cell and this doesn't seem to be working for Excel. Any other ways to do this?
P.S: Im using the MS Excel for Mac
Two steps
Format the cells to Number with one decimal place
Conditionally format the cells to a Number Format of General if the value is an integer
EDIT: Since you cannot conditionally format the number format in Excel for MAC, there are several workarounds.
If you do not mind changing the actual value, add a column which you will use to display the result. Format the Column as "General", and use this formula (assuming your "real data" is in column A:
=IF(A1<>INT(A1),ROUND(A1,1),A1)
Other options that may work would include using an event-triggered macro (if that can be done in Excel for Mac); and possibly you can create the worksheet in Excel for Windows and the conditional format might be recognized in Excel for Mac, even if you can't create it there.
As explained in the documentation here,
Suppose that cell A1 contains 823.7825.
...
=ROUND(A1,2) ... equals 823.78
You should be able to therefore apply this to your entire column to get the precision that you are after.
Rather than using =INT(<another_cell_value>*100)/100 to derive the format you want, simply specify a custom format with the following:
#,###.##
This way, you only get the number of decimal places that you specified in the ROUND function.
I have two excel sheets in a document used to make charts from number estimates. One sheet is a database query via plugin that imports data into excel. When pulling the data from my database, you can see the plugin correctly does not populate blanks with a 0 in columns C and D.
RallyQuery
The 2nd sheet is used to perform calculations in order to make the charts. If you look closely, columns G and H should exactly match C and D from the previous picture, however, excel has added zeros in cells that were blank in the database. The formula used to pull the data from the first sheet is:
=IFERROR(AgileCentralQueryResultList[#PlanEstimate],"")
I need excel to stop replacing blanks with zeros without removing any true zeros that were correct in the database. All of the answers I've found also remove the true zeros, which will not work.
Totals
You need to adjust your formula a little bit, A blank cell apparently is not going to produce an error. so you may want to drop the iferror part of your formula and go with an if. If you have source cells that contain actual error results then you will need to do a second if.
Option 1
=IF(AgileCentralQueryResultList[#PlanEstimate]="","",AgileCentralQueryResultList[#PlanEstimate])
Option 2
=IF(OR(AgileCentralQueryResultList[#PlanEstimate]="",ISERROR(AgileCentralQueryResultList[#PlanEstimate])),"",AgileCentralQueryResultList[#PlanEstimate])
Option 3
=IFERROR(IF(AgileCentralQueryResultList[#PlanEstimate]="","",AgileCentralQueryResultList[#PlanEstimate]),"")
I would try option 1 first and see if you need to take that extra step for error checking using option 2.
Using all the great changes from "Forward Ed" I was able to add my IFERROR check back to his formula to get it all to be happy again. Thanks a ton Ed, credit goes to you for guiding me.
=IFERROR(IF(OR(AgileCentralQueryResultList[#PlanEstimate]="",ISERROR(AgileCentralQueryResultList[#PlanEstimate])),"",AgileCentralQueryResultList[#PlanEstimate]),"")
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)