I want to read the result of the cell value into a variable. The cell which was used as an array formula to calculate the XIRR value. can I do this using libxlsxwriter?
can I do this using libxlsxwriter?
No. Libxlsxwriter cannot be used to read an xlsx file and it also doesn’t calculate the result of a formula; it just writes a default value of 0.
Related
Into a google spreadsheet i want to import a csv data (with IMPORTDATA() function) that contains some arbitrary (textual) codes. The function tries to (incorrectly) interpret some of those codes as numbers/dates and setting text as cell format for destination cells doesn't help.
So how to prevent IMPORTDATA() from automatic text to number/date conversion?
After some trial/error i have found that wrapping the function IMPORTDATA() with ARRAYFORMULA() seems to prevent this behaviour:
=ARRAYFORMULA(IMPORTDATA("..."))
I am reading an Excel file (see syntax below) where some of the fields are text mixed with numbers. The problem is that SPSS reads some of these fields as numeric instead of string and then the text is deleted.
I assume this happens in cases where a large part of the first rows are empty or with a numeric value and then it defines the variable as numeric.
How can this be avoided?
GET DATA
/TYPE=XLSX
/FILE='M:\MyData.xlsx'
/SHEET=name 'Sheet1'
/CELLRANGE=FULL
/READNAMES=ON
/DATATYPEMIN PERCENTAGE=95.0
/HIDDEN IGNORE=YES.
When you use the get data command, the subcommand /DATATYPEMIN PERCENTAGE=95.0 tells SPSS that if up to 5% of the values in the field do not conform to the selected format it's still ok. So in order to avoid cases where only very few values are text and the field is read as number, you have to correct the subcommand to:
/DATATYPEMIN PERCENTAGE=100
I have several cells which are formatted to hold "Accounting" values. Their values are all defined using some variant of this formula:
=sum(SomeColumn1:SomeColumn1000)+sum(OtherColumn1:OtherColumn1000)
When the value is 0, most of the cells display as $ - . However, a few of them display as $ 0.00.
What is the cause for this inconsistency and what can I do to enforce the first format?
Try this:
=round(sum(SomeColumn1:SomeColumn1000))+round(sum(OtherColumn1:OtherColumn1000))
the 0.00's are likely non-zero values due to floating point errors further upstream in your sheet than that particular formula you're asking about.
Currently, pasting 112,359,1003 into Google Sheets automatically converts the value to 1123591003.
This prevents me from applying the Split text to columns option as there are no commas left to split by.
Note that my number format is set to the following (rather than being Automatic):
Selecting the Plain text option prevents the commas from being truncated but also prevents me from being able to use the inserted data in formulas.
The workaround for this is undesirable when inserting large amounts of data: select cells that you expect to occupy, set to Plain Text, paste data, set to back to desired number format.
How do I disable the automatic interpretation by Google Spreadsheet of the commas in my pasted numeric values?
You can not paste it in any number format, because of the nature of numerical format types. It will parse it into an actual number and physically store it in this format. Using plaintext type, like you are, is the way to go for this.
However, there are some options to perform these tasks in a slightly different way;
- you might be able to use CSV-import functionality, which prevents having to change types for a sheet.
- you can use int() function to parse the plaintext value into an int. (and combine this with lookup functions).
TEXT formatting:
Use ' to prepend the number. It'll be stored as text regardless of actual formatting.
Select the column and set formatting as `plain text.
In both the above cases, You can multiply the resulting text by 1 *1 to use in any formula as a number.
NUMBER formatting:
Keep Number formatting with ,/Automatic.
Here, though split text to columns might not work, You can use TEXT() or TO_TEXT()
=ARRAYFORMULA(SPLIT(TO_TEXT(A1:A5),","))
I'm trying to use GoogleFinance currency conversion on a sum but can't get the correct format. My cell is as follows:
=SUM(((IMPORTRANGE("sheet-key","H2:H300"))/100*40)+(IMPORTRANGE("sheet-key","H2:H300")))
I want the results of the sum to be then converted from GBP into USD. I tried adding &GoogleFinance("CURRENCY:GBPUSD") to the end but that's obviously wrong. I can get it to work if I put the conversion in an adjacent cell but that's not what I want.
To begin with, just making sure that you understand the IMPORTRANGE function. Usually this function yields an array of data (in your case 299 values). But in your case this formula fails to yield the array. If the given formula...
=SUM(((IMPORTRANGE("sheet-key","H2:H300"))/100*40)+(IMPORTRANGE("sheet-key","H2:H300")))
...works, then you get only the result of the first cell (H2), i.e. just this: H2/100*40+H2. All the remaining cells (H3:H300) are not processed. Do you really want that? If so, then OK, just proceed to the solution.
If you actually want the whole range (H2:H300) to get processed you should use this formula:
=SUM(ARRAYFORMULA(((IMPORTRANGE("sheet-key","H2:H300"))/100*40)),ARRAYFORMULA(IMPORTRANGE("sheet-key","H2:H300")))
The solution.
To do a conversion you should multiply your result by the currency conversion rate using * symbol:
*GoogleFinance("CURRENCY:GBPUSD")
as opposed to
&GoogleFinance("CURRENCY:GBPUSD")
Note: GoogleFinance() is ever updating.