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?
Related
I am trying to automate a task that's repetitive but I'm aware that hyperlink doens't allow me to copy and paste a range of cells so I'm doing the tedious task of trying to format it correctly but it seems the amount of blank cells in a string is creating too much of a issue. Is there a way to edit it to where I don't have to have so much white space to create the format I need?
I should mention, when I evaluate the formula, it returns everything correctly but then it gets to "Send Email" and I get a #VALUE error.
The goal is to format it into 4 columns and space it out.
(The only reason why I'm using a formula instead of VBA is because the higher-ups do not want VBA due to how sensitive the spreadsheet is.)
=HYPERLINK("mailto:" & F16 & "?subject=Testing" &"&body=" & " Product " & " Agvance Blend Ticket " & " Invoice/ Transfers # " & " Qty " & "%0A"
& CONCATENATE(" ", C5," ",E5," ",F5, " ", G5) & "%0A"
& CONCATENATE(" ", C6," ",E6," ",F6, " ", G6),"Send Email")
If whitespace is the problem, then don't use it; use the Outlook tab character instead, e.g.
=HYPERLINK("mailto:" &F16&"?subject=Testing&body=%09Product%09%09Agvance Blend Ticket%09%09Invoice/ Transfers #%09%09Qty%0A"
&CONCATENATE("%09",C5,"%09%09",E5,"%09%09%09%09",F5,"%09%09%09%09",G5,"%0A")
&CONCATENATE("%09",C6,"%09%09",E6,"%09%09%09%09",F6,"%09%09%09%09",G6),"Send Email")
sample draft email
I need to trim in Power Query a column that has the following structure:
"ABC (XI 011)"
"ABC (XI1 02)"
I need to trim/ get every value between "(" and " ".
And I need to trim/ get every value between " " and ")".
For the 2 examples above the result should be for the first column:
XI
XI1
And for the second column:
011
02
Is there any chance to get this result with Power Query functions?
Use such code:
let
Source = #table({"col"},{{"ABC (XI 011)"}, {"ABC (XI1 02)"}}),
split = Table.SplitColumn(Source, "col", (x)=>Text.Split(Text.BetweenDelimiters(x, "(", ")")," "))
in
split
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 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"}