Excel pasting data issue - excel

Hi all i have been conducting research using JNNS creating neural networks.
I have collected my results inside a result file and wish to create graphs with them to clearly present my findings in a report.
My issue is when pasting the result file contents (expected outputs and then actual outputs) into excel the whole set of results goes into the A1 column instead of spreading across multiple rows
Does anyone know how i would go about fixing this issue?
Example to aid question:
1.1 Expected result / actual result
0, 0, 1, 0
0.02501, 0.00013, 0.99952, 0
and pasting this into excel does this:
https://gyazo.com/38c089ebcfaca7b85d31caacd3e950f9
instead of this:
https://gyazo.com/22f1527df18e811871e53402cea4ab2f
Thanks

I am guessing your data is in a CSV format, do you have notepad++?
if you do open it there and click on the show all characters, i wanna know what do you have at the end of your lines CR or LF...

Thanks to OmarQA for the help, i needed to paste my data into a text file, replace all spaces with commas using the replace tool, then import data from text on excel and use comma as data separation and it solved the issue!
Thanks

It might be that excel's not recognizing the proper delimiter when you're pasting you data. On Excel, select the cell with the entire text (in your picture, cell A1) and go to the Data tab. Look for a button called "Convert text to columns" or something like that. It will open a new window asking you for parameters (delimiters, if comma is a decimal separator, etc) and it gives you a preview of how your data is going to look like with that setting. Just mess around a little bit and you should get your data good to go. Looking at your picture, it might be possible that you didn't select "tab" as a delimiter.

Related

AnyLogic: False number format when exporting data to excel

I collect various data in time plots. If I copy the timeplot data and then paste it into Excel, the number format is often wrong. For example, I often get a date like Aug 94 instead of the actual number from the TimePlot. Unfortunately, I can't easily format this date into a number either, since the formatted number does not match the actual number from the timeplot. If I format the date in the same format as the number above and below, then I get the number 34547. However, this number does not correspond to the actual number of the TimePlot. Anyone know how I can prevent this problem?
You can only solve this on the Excel side, AnyLogic provides the raw data for you. Excel then interprets stuff. You can test it by pasting the chart raw data into a txt or csv file.
So either fix your Excel settings or paste into a csv, then into an xlsx.
Or better still: Do not manually paste at all. Instead, write your model results into the AnyLogic database and export to Excel from there: this takes away a lot of the pain for you. Check the example models to learn how to do that.
This is not AnyLogic question, rather an Excel & computer formatting problem. One way of resolving this is changing computer's date and time settings.
Another way is to save your output at txt file in AnyLogic. Replace all . with ,. Then open empty Excel, select Text format for the columns. Copy-paste from the txt file.
In Excel there are a few options
when you paste use paste as text only option
But this does not always work as Excel will still try to format the stuff for you
Use the Paste Special option and then choose text
Also possible this will not work, based on your Excel settings.
Paste using the text import wizard
(This works for me without fail)
On step 2 choose tab delimited
On step 3 choose Column format as text for every column (you need to select them in the little diagram below)
You will then see the data exactly as it came from AnyLogic. See the example below where I purposefully imported some text which has something that Excel will think is a date. You will now be able to see what in your data made Excel thing your data needed to be formatted the way it is and then you can fix it. (post a new question if you struggle with this conversion)
But as noted by other answers first prize is to write all the important data to external files. But I know that even I sometimes want to export data from a chart and review it in Excel. Option 3 works for me everytime

HH:MM:SS:MS Formatting in excel

I have a lot of data in the form of
"00:00:03:19"
(hh:mm:ss:milliseconds)
I can not do much with it since excel is interpreting the data as text. Under "format cells/custom"
I can not find an appropriate entry for the data.... How can I teach/show excel what kind of data I am processing there?
I'm afraid the only option for Excel to read that properly is to somehow replace the last colon : with a decimal point. It's not until Excel understood your data as expected that you can think of the appropriate display format.
How are you receiving this data? If you can have all these values aligned in a single column in a csv file for example, by using a good text editor like Notepad++ you could select all the last : with ALT + mouse, replace them all at once, and finally load that into Excel.
One option is:
=SUBSTITUTE(A1,":",".",3)
select, Copy, Paste Special, Values then Text to Columns with Tab as the delimiter.
I found another solution!
I pasted the timevalues into the A column and split it via the LEFT,MID RIGHT comands
(eg:00:00:01:21 in A3)
A---------------------B-----------------C----------------D---------------E-----------------------F--------
00:00:01:21 -- LEFT(A3;2) -- MID(A3;4;2) -- MID(A3;7;2) -- (RIGHT(A3;2)) -- E3+(D3*1000)+(C3*60000)+(B3*3600000)

Looking up multiple values in a list

I'm trying to select multiple values based on a search key. In it's most basic form there is no problem with this. I followed this example and everything went well:
http://office.microsoft.com/en-us/excel-help/how-to-look-up-a-value-in-a-list-and-return-multiple-corresponding-values-HA001226038.aspx
=IF(ISERROR(INDEX($A$1:$B$7,SMALL(IF($A$1:$A$7=$A$10,ROW($A$1:$A$7)),ROW(1:1)),2)),"",INDEX($A$1:$B$7,SMALL(IF($A$1:$A$7=$A$10,ROW($A$1:$A$7)),ROW(1:1)),2))
The problem with this however is that in my case I have multiple CSV files (external) where some values in my A$ column look like this:
=- sometext // results into #NAME? error
Excel interprets these as a formulas where it is actually only supposed to be a string. Sure I could change it to text and save it again but I would like to avoid any manipulation in these CSV files.
I tried to extend the second IF statement (if you read it from left to right) with:
IF(AND($A$1:$A$7 <> "#NAME?", $A$1:$A$7=$A$10,ROW($A$1:$A$7)))
and
IF(AND(NOT(ISERROR($A$1:$A$7)), $A$1:$A$7=$A$10,ROW($A$1:$A$7)))
Both didn't work. (Sorry if I messed up some syntax and formula names, I'm using a different language version)
Here a small image of what's happening right now and how it should look:
On the right site you can see a list of values right next to Test1 which are missing on the left site due to the #NAME? error.
I would suggest opening the csv's files as text files. Selecting Comma as your delimiter and then select Text as your Column data format. This way, Excel will treat all your data as text and will not try to read =- sometext as a formula.
To do so, you would need to change your .csv files extension to .txt or anything else (even no file format).
Instead of "Opening" the CSV file, you can "Import" it. This will open the Text Import Wizard which will allow you to specify particular columns as Text. This is located in different areas in different versions of Excel. In Excel 2007, it is on the Data Tab / Get External Data / From Text. The example below demonstrates bringing in long numbers, but it should work just as well with your formula "lookalikes"

How do I load data into Win Bugs from Excel or from Notepad (doc ending with .txt)?

I need to load some data into WinBugs from Excel and for some reason, Winbugs doesn't recognize it. There are many things I have tried (all of which are listed below) and none of these work.
I tried to copy from Excel and 'Paste Special' as 'Plain Text' into WinBugs. I added [] after every variable and even 'END' at the end. The error message came up as follows:
Sorry something went wrong in procedure LoadNumeric Data in module BugRectData
I copied and pasted into notepad, added [] after every variable and even 'END' at the end again and then removed all the space between the lines, and only one space between each data. When I dragged it into Winbugs, it dispersed into double space between the lines and large gaps between the data and the error message came up (when trying to load the data):
Sorry something went wrong in procedure LoadNumeric Data in module BugRectData
The last thing I did was to open the .txt file into Winbugs and it became all jumbled and when I tried to load the data, instead it highlighted some data such as NA2.0 that should have been NA 2.0 and said it "expected a number or an NA or END". After correcting these mistakes, the data seemed fine until the end where it said 'END' and it said the same thing only highlighting the E on the END.
If anyone could give any insight I would be most grateful.
It would be easier to answer if you had included part of your dataset, as you have included it in the Winbugs compound document. As stated in the Winbugs manual (http://www.mrc-bsu.cam.ac.uk/bugs/winbugs/manual14.pdf) data can be entered in S-plus format or in rectangular format. Rectangular format has the form:
Y[] x[]
5 4.1
3 2.1
4 3.5
END
S-plus format (as an example):
list(Y=c(5,3,4),x=c(4.1,2.1,3.5))
Have you tried these specifically and with the full correct syntax? In rectangular format the arrays must be of equal length, and all must have a heading.
I wouldn't do direct copy/paste from excel to winbugs since all kinds of strange formatting can come along. Try to copy the data to .txt first or save as a tab spaced .csv. Check that the file looks ok before you insert it to Winbugs, using e.g 'Paste special' and plain text.
From: ↨here download the file "writeDatafileR.txt". For details here's a link!
Write in R:
source("writeDatafileR.txt")
Given that df is a data.frame, type in the R command prompt:
writeDatafileR(df," df.txt")
This will make a file "df.txt" with the data that we may copy and paste in our Winbugs code.

display preceeding zeros in csv file when viewing in excel

Is this at all possible?
If I open up my file in standard text editor e.g. notepad the preceeding zeros are displayed.
e.g. 000485001 shows up.
Although this doesn't happen in excel. All that's displayed is 485001
Just wondering if there's a way around this?
Thanks,
Yes, when you're importing (or using 'Text to columns') you can explicitly indicate the data type for a column (instead of General). If you select 'Text' the zeros will not be dropped.
Unfortunately you only see the dialog to specify this option when Excel is already open and you use either File/Open or Data/Text to Columns. If you just double click a .csv in the explorer you don't get this choice.
Excel tries very hard to determine the type of value it's importing. If it looks like a number, it will treat it like a number, and drop all the leading zeros as it reads it in. There's no way to get them back once they're lost.
You might try to import the file using the wizard that lets you set the data type for each column.
Rather than writing your data as a CSV file, use the SYLK (Symbolic Link) format instead. This format includes information about the style of a column, so that Excel will not try to auto-guess the type of data.
The easiest way to get started with this format is to export a small file from Excel and use that as a template.
Ok got around this by inserting a text character before the number i.e. #000485001
Simple enough!

Resources