I have a fieldfunction that formats a given number (price) from an excel table.
i.e.:
Fieldname = FieldName & " \# #.##0,00 USD"
It works, but if the value is less than a thousand, the hashes and the point are read as spaces.
How can I remove or prevent the spaces to show up in the word file?
Too many # in format..try this:
Fieldname = FieldName & " \# #.#0,00 USD"
Just for further clarification, I didn't really know how the code above used in mergefield by questioner..usually formatting mergefield look like this:
{MERGEFIELD ANum \# "#.#0,00 USD"}
Related
I am writing a program that will use readtable to manipulate data that is read from an Excel spreadsheet such as the one below:
A B C D E F...
1 " " " " " "
2 " S 3 K3 " "
3 " " " " " "
4 " " 10 3C " "
5 " G 7 U " "
6 " " " " " "
.
.
.
I must extract the original location of some of the data, that is I need to store the location of 'S' as 'B2' and 'K3' as 'D2' etc. after they are read from the spreadsheet. To do this, I use readtableand then search for the location in the spreadsheet that contains the desired string; however, this requires that the entire spreadsheet be loaded into MATLAB.
I don't know in advance the number of empty rows or columns before 'S', nor do I know if some data will be filled in any of the columns in the rows above it. Additionally, I don't want the variable names to be generated automatically.
readtable('FilePath', 'ReadVariableNames', false, 'Range', 'myrange')
allows for not reading the variable names but doesn't allow for a dynamic range, i.e. the default option will skip the blank space and a specified range can't be dynamic.
opts=detectImportOptions('FilePath');
opts.DataRange='A1'
readtable('FilePath', opts, 'ReadVariableNames', false)
allows for specifying a start of the range but opts=detectImportOptions overwrites the 'ReadVariableNames' option, and the program reads the variable names anyway. The only workaround that I found was to use readtable without opts and to specify a range larger than the largest anticipated data set and then to trim empty rows and columns, but this is slow and clumsy. Is there a workaround?
I have text string in cells that I want to interrogate and then have all matching text values displayed in one cell.
I'm currently using:
=IF(ISNUMBER(SEARCH("horse",G360)),
"horse",
IF(ISNUMBER(SEARCH("cat",G360)),
"cat",
IF(ISNUMBER(SEARCH("monkey",G360)),
"monkey",
IF(ISNUMBER(SEARCH("donkey",G346)),
"donkey"))))
However of course this only shows the first matching value not ALL matching values. How would I do this?
If a cell contained text "blah cat blah blah monkey blah blah horses" the formula result would be "Horse, Monkey" not just "Horse".
In the sample even CAT will also come in I suppose.
For limited number of items case you could try:
=SUBSTITUTE(TRIM(CONCATENATE(
IF(ISNUMBER(SEARCH("horse",G360)),"horse "," "),
IF(ISNUMBER(SEARCH("cat",G360)),"cat "," "),
IF(ISNUMBER(SEARCH("monkey",G360)),"monkey "," "),
IF(ISNUMBER(SEARCH("donkey",G346)),"donkey "," ")
))," ",", ")
If SNR text exists it gets values of AD6. If it doesn’t exist it get values of AD6.
If SR exists, it gets value of AA1
I am able to get this working with =IF(ISERR(SEARCH("SNR "," " & Sheet1!$D6& " ")),Sheet1!AD6,AD6)
However I cannot seem to include SR.
=IF(ISERR(SEARCH("SNR "," " & Sheet1!$D6& " ")),Sheet1!AD6,AD6) AND IF(ISERR(SEARCH("SR "," " & Sheet1!$D6& " ")),Sheet1!AA1,AA1)
Is there a way around this issue or is this a limitation of excel?
I have included an image to more accurately convey what I am saying.
I have a formula below:
=ISNUMBER(SEARCH("Perso",$A2))
I want to it return True for the field that exactly contains my key word "Perso"
However, from the image you can see that both rows return True, because the word "person" also contains "perso".
Can anyone provide some suggestions on how can I achieve my goal in Excel.
Include the deliminating space:
=ISNUMBER(SEARCH(" Perso "," " & $A2 & " "))
I'm trying to find if cells have specific string or not. This is how I do it right now:
=IF(ISNUMBER(SEARCH("AAA";L2)); "yes"; "no")
If a cell has "AAA", I write to another cell yes, if not, I write no...
The problem is that it also gets true answer for AAA1 or AAA1234 for an example, how can I return true statement only for AAA?
If there are trailing numbers/charcters in my string, I want to reutrn no, but the cell itself might be longer... for and example "AAA BVC BFD2" etc. Then I want to return true. False if for an example: "AAA1 BVC BFD2"
As I mentioned in comments, you can use this one:
=IF(ISNUMBER(SEARCH(" AAA ";" " & L2 & " ")); "yes"; "no")
How it works:
suppose you have a string "AAA BVC BFD2" in cell L2.
" " & L2 & " " part modifies this string to " AAA BVC BFD2 " (note, there're additional spaces in the end and in the beggining)
now, we're able to search " AAA " (with spaces) in modified string " " & L2 & " ".
I'm clearly missing something as it seems to me that you could do this with something as simple as
=IF(LEFT(A1,4)="AAA ","yes","no")
I don't think the question is particularly clear, if I'm being honest...