I'm using office writer reports to export data to excel. In that I have some reference number field which is 00033444. I have set the cell formatting to "text". But it still displays without leading zeros like 3344.
I'm using Office Writer 8.4 version.
Any help plz?
OfficeWriter's ExcelTemplate approach will always attempt to convert numerical strings to numbers and there are several options to ensure that your numerical strings are preserved:
Option 1: In your code, set ExcelTemplate.PreserveStrings to TRUE. This will import all numerical strings as strings.
Option 2: In your template file, add the 'Preserve' modifier to the data marker that corresponds to the reference number field. For example, %%=DataSet.ReferenceField(Preserve).This will import numerical strings from that column of data (i.e. ReferenceField) as strings instead of numbers.
You can set the number formatting of the cell that contains the data marker to be text, but it is not necessary to preserve numerical strings. If you use one the options above, the numerical strings will be imported as strings, regardless of the number format in the template.
Related
I am trying to program some VBA code that creates a dropdown menu in a certain cell of an Excel Worksheet. The synatx is clear, The doubles that should be in the list are collected in the array MyList(). I use the following approach to set the data validation as follows:
Range("A1").Validation.Add xlValidateList, xlValidAlertStop, Formula1:=Join(MyList, ",")
I (and the users of my program) work on a computer with the locale set to German. This includes that the decimal separator is a comma, while the separator of a validation list is a ";". As a result, if MyList contains the three values (3, 4.268, 5), the dropdown menu will show the four numbers (3, 4, 268, 5).
Of course, a workaround would be to first print the values either to some cells in the same worksheet or to a different (possibly hidden) worksheet. However, I consider this quite an ugly approach.
I also tried to convert the doubles to a string with a dot as decimal separator. However, there are two problems with that: for one, my sorting routine doesn't work anymore, it now sorts the values e.g. as (1, 10, 100, 2, 26, 3, 30, 300, etc.). Secondly, and even more important, Excel now interpretes the data also as a string. Later on in the code, I read out the data again and first would need to transform the data back from a string to back to a double. Also, there are some worksheet functions that also use this value, so I would also need that conversion in worksheet functions.
As there will be a larger body of users and this application only a smaller one, changing the locale settings of Excel or Windows is also not an option.
I couldn't get the dummy character method described here to work: Excel VBA: how to add data validation list which contain comma included value without using reference of Range. For me, the replacement seems not to work: The dropdown menu has only one entry that contains the whole string still separated by the dummy character.
So the question is: Is there a way to generate a validation list directly in VBA with a locale which uses the comma as decimal separator?
I am importing data from an Excel file into a Filemaker Pro database (FMP 12.0 v5 for Mac). I am using the imported data to "Update matching records in found set". However, the field that I am using to match occasionally contains trailing zeros.
When importing, FMP does not match the fields correctly, because it ignores the trailing zeros.
To explain further: the field in the database is a calculated text field, "courseID.personID", determined by concatenating the numerical "courseID" and "personID" fields (with a dot in between them). The field in my Excel file is formed similarly, using Excel formulae. Some "personID" values end in a zero, e.g. 120, and so courseID.personID becomes something like "123.120". I am matching the Excel field to the FMP field.
I first noticed this was happening, and was very careful to go back to Excel and make a new file (to start fresh), select all cells and set format to Text. Then, I did a Paste Special from my original data, and selected Paste as Values. All the cells in the courseID.personID column gave a "number stored as text error", with the option to convert the text to numbers. I selected the option to ignore the error, to leave all the data stored as text, with the intention of preserving the trailing zeros.
Alas, the issue persists. So, does anyone have any ideas of how to force Excel to format and communicate the proper values? Or, is it an issue of making FMP interpret the data properly, maybe by adjusting field types?
the field in the database is a calculated text field,
"courseID.personID", determined by concatenating the numerical
"courseID" and "personID" fields (with a dot in between them). The
field in my Excel file is formed similarly, using Excel formulae.
Come to think of it, the simplest solution would be to eliminate the calculation fields and use the original values for the import:
Is there a way to stop Excel 2010 from doing math on a bunch of cells containing multiple numbers with leading plus or minus signs? E.g.
-706795 -1456130 -1869550 -936304 -1729830 -1737860 -687165 -16807800
Right now it sums the numbers up into one value. I would like them displayed as above. Formatting the cell as text doesn't work. I get this data from a CSV and have limited control over its contents...
Use a single quote
'-706795 -1456130 -1869550 -936304 -1729830 -1737860 -687165 -16807800
Use the text import wizard to load each value into an individual column. You may have to rename the CSV file as '.txt' to get the import wzard up by default, (shameless rep seeking here:).
Is there a character to mask STRING values within the Excel TEXT function?
Attempting to use a mask of "0000-000000-00000-0000" seems to convert a string to a number. I simply want to add hyphens in between a specific number of characters.
I have also tried "####-######-#####-####" and "####-######-#####-####" but to no avail.
Background:
In a previous question, it was determined that a particular custom number mask could not be applied to a string because of the 15 significant digit limitation in Excel.
The goal was to convert a TEXT value of 5145350002005000080 to 5145-350002-00500-0080 using the following formula:
=text(A1,"0000-000000-00000-0000")
The output produced was:
5145-350002-00500-0000
You will need to use Excel string functions.
This works, though it is not the usual way of getting the job done:
=REPLACE(REPLACE(REPLACE(A1,16,0,"-"),11,0,"-"),5,0,"-")
The more typical method:
=LEFT(A1,4)&"-"&MID(A1,5,6)&"-"&MID(A1,10,5)&"-"&RIGHT(A1,4)
Unfortunately it's impossible to apply markup to any string value using TEXT - as per TEXT function description, it may be done only for numbers:
The TEXT function converts a numeric value to text and lets you
specify the display formatting by using special format strings.
Syntax
TEXT(value, format_text)
The TEXT function syntax has the following arguments:
value Required. A numeric value, a formula that evaluates to a numeric value, or a reference to a cell containing a numeric value.
So it looks like the only way for you to achieve what you want - is to apply recommended string conversions.
Select the cells->Press Ctrl+1->from Number Tab of Format Cells Dialog select "custom" and paste in Type edit box Below.
"Boxes";"Boxes";"Boxes";"Boxes"
Source: Here
I have a matrix where the first column contains dates and the first row contains maturities which are alpha/numeric (e.g. 16year).
The rest of the cells contain the rates for each day, which are double precision numbers.
Now I believe xlsread() can only handle numeric data so I think I will need something else or a combination of functions?
I would like to be able to read the table from excel into MATLAB as one array or perhaps a struct() so that I can keep all the data together.
The other problem is that some of the rates are given as '#N/A'. I want the cells where these values are stored to be kept but would like to change the value to blank=" ".
What is the best way to do this? Can it be done as part of the input process?
Well, from looking at matlab reference for xlsread you can use the format
[num,txt,raw] = xlsread(FILENAME)
and then you will have in num a matrix of your data, in txt the unreadable data, i.e. your text headers, and in raw you will have all of your data unprocessed. (including the text headers).
So I guess you could use the raw array, or a combination of the num and txt.
For your other problem, if your rates are 'pulled' from some other source, you can use
=IFERROR(RATE DATA,"")
and then there will be a blank instead of the error code #N\A.
Another solution (only for Windows) would be to use xlsread() format which allows running a function on your imported data,
[num,txt,raw,custom] = xlsread(filename,sheet,xlRange,'',functionHandler)
and let the function replace the NaN values with blank spots. (and you will have your output in the custom array)