I am a beginner in netlogo. I find the Netlogo Manual not always as explicit as I feel it should be, as exemplified by the folowing task. My feeling is that this task ought to be relatively simple, but so far I have not been able to accomplish it. I have searched for hints on this forum to help me, but perhaps my problem is so simple that nobody has yet come up with a corresponding question.
The task is: Write data into columns of an Excel file such that for each tick six data points form a row of data across six columns (say across columns A, B, C, D, E, F of the Excel file). I do not find the command to assure that after each data point, having been entered into its column, the next column is selected to enter there the next data point.
This starts already with the headings of the columns for which I give the commands in the setup procedure as below:
...
if (file-exists? "TO_test.csv") [carefully [file-delete "TO_test.csv"] [print error-message]]
file-open "TO_test.csv"
file-type "number,"
file-type "name,"
file-type "age,"
file-type "height,"
file-type "income,"
file-type "status,"
file-close
....
The output in the Excel file is then
number, name,age,height,income,status,
all in one comlumn. I use the 'type' command because that assures that entries are made in the same line. I added the ‘,’ to each string because I believe to have picked up somewhere that this causes the shift to the next column (which, however, it does not). If I use 'file-print' instead of 'file-type' I get an entry in successive lines instead of columns, because here the ‘,’ causes a ‘return’ command.
What I would like to get is the following (where the first line shows the given headings of the Excel file):
A B C D E F
number name age height income status
Related
To preface: I don't know if this is even the right question to ask, but I basically need 3 columns to match another 3 columns in Excel.
I have some BBS data that was pre-selected by the professor for the class. Now, they have challenged us to make a map out of the data he's given us; and nicely enough, BBS collects route location data (longitude/latitude). Unfortunately, the given data by the prof does not have long/lat data and it's up to me to figure out which route is which.
The raw BBS data contains the long/lat data, which I would need to extract and put into a .csv file so I can work with it on GIS.
Image of Dataset I'm working with
So, I need the columns A, B, and C to match columns in L, M, and N. Then, I would just extract the long/lat data manually. There's 328 long/lat data points I would copy and paste.
i think, you need to map "A to B" column cell against Column "L to H".
so best way to this, use vlookup, if it's related to multiple critera then create key of both cell and according use vlookup.
for key see below
I am trying to enter approximately 190 txt datafiles in Excel using the New Query tool (Data->New Query->From File->From Folder). In the Windows explorer the data are properly ordered: the first being 0summary, the second 30summary etc.
However, when entering them through the query tool the files are sorted as shown in the picture (see line 9 for example, you will see that the file is not in the right position):
The files are sorted based on the first digit instead of the value represented. Is there a solution to this issue? I have tried putting space between the number and the summary but it also didn't work. I saw online that Excel doesn't recognize the text within "" or after /, but I am not allowed to save the text files with those symbols in their name in Windows. Even when removed the word summary the problem didn't fix. Any suggestions?
If all your names include the word Summary:
You can add a column "Extract" / "Text before delimiter" enter "Summary", change the column type to Number and sort over that column
If the only numbers are those you wish to sort on, you can
add a custom column with just the numbers
Change the data type to whole number
sort on that.
The formula for the custom column:
Text.Select([Name],{"0".."9"})
If the alpha portion varies, and you need to sort on that also, you can do something similar adding another column for the alpha portion, and sorting on that.
If there might be digits after the leading digits upon which you want to sort, then use the following formula for the added column which will extract only the digits at the beginning of the file name:
=Text.Middle([Name],0,Text.PositionOfAny([Name],{"A".."z"}))
The attached image (link: https://i.stack.imgur.com/w0pEw.png) shows a range of cells (B1:B7) from a table I imported from the web. I need a formula that allows me to extract the names from each cell. In this case, my objective is to generate the following list of names, where each name is in its own cell: Erik Karlsson, P.K. Subban, John Tavares, Matthew Tkachuk, Steven Stamkos, Dustin Brown, Shea Weber.
I have been reading about left, right, and mid functions, but I'm confused by the irregular spacing and special characters (i.e. the box with question mark beside some names).
Can anyone help me extract the names? Thanks
Assuming that your cells follow the same format, you can use a variety of text functions to get the name.
This function requires the following format:
Some initial text, followed by
2 new lines in Excel (represented by CHAR(10)
The name, which consists of a first name, a space, then a last name
A second space on the same line as the name, followed by some additional text.
With this format, you can use the following formula (assuming your data is in an Excel table, with the column of initial data named Text):
=MID([#Text],SEARCH(CHAR(10),[#Text],SEARCH(CHAR(10),[#Text])+1)+1,SEARCH(" ",MID([#Text],SEARCH(CHAR(10),[#Text],SEARCH(CHAR(10),[#Text])+1)+1,LEN([#Text])),SEARCH(" ",MID([#Text],SEARCH(CHAR(10),[#Text],SEARCH(CHAR(10),[#Text])+1)+1,LEN([#Text])))+1)-1)
To come up with this formula, we take the following steps:
First, we figure out where the name starts. We know this occurs after the 2 new lines, so we use:
=SEARCH(CHAR(10),[#Text],SEARCH(CHAR(10),[#Text])+1)+1
The inner (occurring second) SEARCH finds the first new line, and the outer (occurring first) finds the 2nd new line.
Now that we have that value, we can use it to determine the rest of the string (after the 2 new lines). Let's say that the previous formula was stored in a table column called Start of Name. The 2nd formula will then be:
=MID([#Text],[#[Start of Name]],LEN([#Text]))
Note that we're using the length of the entire text, which by definition is more than we need. However, that's not an issue, since Excel returns the smaller amount between the last argument to MID and the actual length of the text.
Once we have the text from the start of the name on, we need to calculate the position of the 2nd space (where the name ends). To do that, we need to calculate the position of the first space. This is similar to how we calculated the start of the name earlier (which starts after 2 new lines). The function we need is:
=SEARCH(" ",[#[Rest of String]],SEARCH(" ",[#[Rest of String]])+1)-1
So now, we know where the name starts (after 2 new lines), and where it ends (after the 2nd space). Assuming we have these numbers stored in columns named Start of Name and To Second Space respectively, we can use the following formula to get the name:
=MID([#Text],[#[Start of Name]],[#[To Second Space]])
This is equivalent to the first formula: The difference is that the first formula doesn't use any "helper columns".
Of course, if any cell doesn't match this format, then you'll be out of luck. Using Excel formulas to parse text can be finicky and inflexible. For example, if someone has a middle name, or someone has a initials with spaces (e.g. P.K. Subban was P. K. Subban), or there was a Jr. or something, your job would be a lot harder.
Another alternative is to use regular expressions to get the data you want. I would recommend this thorough answer as a primer. Although you still have the same issues with name formats.
Finally, there's the obligatory Falsehoods Programmers Believe About Names as a warning against assuming any kind of standardized name format.
I am unsure Excel would be able to do this automatically. I hope it can but maybe not.
I am trying to work with another member of staff in a different building. I have created a table trying to identify where the flow of some of the work is coming from. I am looking to try and count the amount of instances of text within a column. The problem is that the text can be pretty dynamic. As an example:
Consultant
a
a
b
a
b
a
b
z
c
c
c
Is there a way I can get excel to count the instances of text within the column, then create a table with the totals of the counts in it with labels.
I looked at pivot tables and that didn't seem to want to play ball.
The simplest way to do this is using COUINTIF
=COUNTIF(A:A,"a")
Which will simply tell you how many times "a" appears in the Column A.
You could easily duplicate this for every letter of the alphabet. Then use a summary table to display the results.
EDIT: Thanks for all the responses everyone. I'm going to go ahead and try and write rules to cover as many of the cases as I can, and either manually extract or try to right more rules to cover everything else.
I am trying to sort the same "types" of data into the same columns. Essentially, I get a data dump where a bunch of data (year, company name, person name, IO number, PO number, project description, and a bunch of comments) dumps into one single column, like this:
The ideal end result would be sorting so that same type of data in the same columns, i.e. all years in column A, all IOs in column B, all POs in column C, all person names in column D, all company names in column E, and whatever is left is dumped into a "comments" section in column F.
I've written a macro that employs the SUBSTITUTE function so that it goes through this string and substitutes all dashes and backslashes with commas, then separates based on the comma delimitor, then re-pastes the text as plain-text. This works fairly well, except for in the occasional case where there are dashes in the name of a company or a backslash to indicate two people who own that IO/PO or when all of the data is entered in without any delimitor such as: 2012 Company project title IO ##### PO #### Person Name.
So here is what I am asking:
1. Is there a better way to parse the data than I am doing now? How can I accommodate for the exceptions such as a dash in the company name or a string where there are no dashes or backslashes, only spaces?
2. Once I have parsed all of this data and separated it into separate columns like so:
how do I sort it so that the same type of information is in the same column?
Any help would be greatly appreciated. Please let me know if anything was unclear.
Welcome to StackOverflow!
If the text follows clear rules, like a separator as "-" or "," you can use the Split() function to get an array of tokens. If the text doesn't follow any rule it's impossible. Very likely you are in the middle, where most of the texts follow the rules. For the other texts, you need to massage your code and try to find new rules and check them with... see below.
Create a few functions IsYear(), IsPO(), IsCompany() that return True if the content is recognized. The functions could be as simple as IsYear = Text Like "20##" or could contain many tests. Then you make a function that checks each cell of each row, and sorts if required.
I'm sorry I can't give you anything more than some generic advice, but this is a very open question for a very challenging problem.
I hope this gets you started.
Along the lines of at #Werner “You can’t make a silk purse …” Obviously the solution is to lean on whoever is responsible for the garbage in to ensure that your source data is in better shape. However I guess you are looking for a workaround. From your example, some ‘tiding’ is possible. Eg sort on ColumnB and where 2012 is in ColumnC exchange the contents of B and C for that row. Then sort on ColumnD and do much that same for D and E. If ColumnF contains Quote insert a blank cell and shift to the right. If ColumnF is blank exchange contents of that row with ColumnD. Move ColumnD to the end. Select anything before Quote in ColumnF and remove it to ColumnE if that is empty, otherwise to ColumnH. The result should look something like:
-rather better than I was expecting and I’d guess about the limit of what could reasonably be programmed.