Be Excellent To Each Other

And, you know, party on. Dude.

All times are UTC [ DST ]




Reply to topic  [ 61 posts ]  Go to page 1, 2  Next
Author Message
 Post subject: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:00 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
Right, I have an Excel sheet exported from an external program and it has 3 sets of data, as below.
millisec - k0 - Count
6.7 - 1.9 - 10692

this is repeated 20 times, eg
millisec - k0 - Count - millisec - k0 - Count - millisec - k0 - Count...

the data is exported as the largest count value in the first set. Over time the count values change so that what is the largest count value in one row isn't the next, therfore the data is all miggled up wrt k0. (does this make an sense?)

I want to be able to filter all data from the sets within given bounds of k0. Is there a quick way of doing this for a spreadsheet? I almost want an SQL type command that says select from (column x, x-1, x+1) where (x > y, x< z). (I bet this makes even less sense)

An easier way to do it might be to concatenate all of the like columns, is there a swift way of doing this? My VBA isn't good enough to sort this, but it isn't none existent.


Any help would be appreciated, but as this is unlikely to make sense to anyone, please feel free to simply ignore it.

_________________
No, it was a giant robot castle!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:04 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Can you post the XLS?

Edit -- I think I understand your problem. Not sure of the best way to solve it, sure we can figure something out though.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:04 
User avatar
Excellent Member

Joined: 11th Dec, 2008
Posts: 332
ignore what?

Sorry


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:07 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Because you're worth it.

I'm afraid I don't really understand the question though :(

Post a chunk of it in a [code] box maybe, and explain again?


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:08 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
There is another column in the first column, but just ignore that, it is a simple count column.

Anything with a ??? means there was nothing present in that cycle.


You do not have the required permissions to view the files attached to this post.

_________________
No, it was a giant robot castle!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:11 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Mass spec data?


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:13 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
Not far off. :) Ion Mobility Spectrometry.

_________________
No, it was a giant robot castle!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:14 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
So you want a flat list of values of C for a given value or range of values of k0? And the millisec numbers and count down the left don't matter?

I think loading it into a database is the way forward.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:16 
User avatar
Hibernating Druid

Joined: 27th Mar, 2008
Posts: 49338
Location: Standing on your mother's Porsche
Beaten me to it there Doc.

_________________
SD&DG Illustrated! Behance Bleep Bloop

'Not without talent but dragged down by bass turgidity'


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:17 
User avatar
Isn't that lovely?

Joined: 30th Mar, 2008
Posts: 11163
Location: Devon
I think in Excel 2007 you can filter like that. Although I'm still not exactly sure what you want to do.

Malc

_________________
Where's the Kaboom? I was expecting an Earth shattering Kaboom!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:18 
User avatar
Isn't that lovely?

Joined: 30th Mar, 2008
Posts: 11163
Location: Devon
Can you not just reformat the stuff so that you only have 3 columns, or is the spectrum number actually important?

Malc

_________________
Where's the Kaboom? I was expecting an Earth shattering Kaboom!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:19 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
It's the data repeating in both rows and columns that are defeating my attempts at an in-Excel solution, I can't beat the pivot table wizard into consuming the data. I wonder if SQL Import Services will consume the data.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:21 
User avatar
Hibernating Druid

Joined: 27th Mar, 2008
Posts: 49338
Location: Standing on your mother's Porsche
Doctor Glyndwr wrote:
I can't beat the pivot table wizard into consuming the data.


Try doing some side-sheets to level up and stock up on Java Applets to regain health.

_________________
SD&DG Illustrated! Behance Bleep Bloop

'Not without talent but dragged down by bass turgidity'


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:22 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Hmm, I'd be tempted to re-format it in a single column (well, 3 columns) by hand - it'd only take 10 minutes. Of course if you need to do this more than once, maybe rig up a perl-script (or hell, even a text editor macro) to pre break-up each line of 20 in the source file?

then you can sort for k0 out of all the data. Is that what you wanted?


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:27 
User avatar
Excellent Member

Joined: 11th Dec, 2008
Posts: 332
Alt-F4


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:29 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49244
Bobbyaro wrote:
the data is exported as the largest count value in the first set. Over time the count values change so that what is the largest count value in one row isn't the next, therfore the data is all miggled up wrt k0. (does this make an sense?)


Fuuuuck, no.

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:37 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
kalmar wrote:
Hmm, I'd be tempted to re-format it in a single column (well, 3 columns) by hand - it'd only take 10 minutes. Of course if you need to do this more than once, maybe rig up a perl-script (or hell, even a text editor macro) to pre break-up each line of 20 in the source file?
Actually, yes. Fuck all this, export it as CSV and run it through a Perl script.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:37 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
kalmar wrote:
Hmm, I'd be tempted to re-format it in a single column (well, 3 columns) by hand - it'd only take 10 minutes. Of course if you need to do this more than once, maybe rig up a perl-script (or hell, even a text editor macro) to pre break-up each line of 20 in the source file?

then you can sort for k0 out of all the data. Is that what you wanted?

This is what I have been doing in the past, but I am getting fed up of doing this and wondered if there was an easier way.

I tried the auto export to access stuff, but I couldn't figure out how to make all of C into one single field (and all of k0).

Cheers guys, don't waste any of your time on it, I just wondered if I was missing something obvious.

_________________
No, it was a giant robot castle!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:39 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
Doctor Glyndwr wrote:
kalmar wrote:
Hmm, I'd be tempted to re-format it in a single column (well, 3 columns) by hand - it'd only take 10 minutes. Of course if you need to do this more than once, maybe rig up a perl-script (or hell, even a text editor macro) to pre break-up each line of 20 in the source file?
Actually, yes. Fuck all this, export it as CSV and run it through a Perl script.

Riiight. Err, this may require a bit of explaining, like all of it. I have never used Perl. :)

I shall look it up on the interweb.

_________________
No, it was a giant robot castle!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:40 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Bobbyaro wrote:
I shall look it up on the interweb.
I'd just wait a bit if I were you :D

Do you just want all the C values for a given k0? It doesn't matter which row of the sheet they appear on?


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:41 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
kind of, for a range of k0 values, eg between 1.844 and 1.708

_________________
No, it was a giant robot castle!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:43 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Bobbyaro wrote:
kind of, for a range of k0 values, eg between 1.844 and 1.708
I'll give you three columns, sorted on k0. How's that? Then you can grab a range.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:43 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
Edit, er maybe not, I need them to be referenced, so a {k0, C} pairing. if you see what I mean.

_________________
No, it was a giant robot castle!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:43 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Bobbyaro wrote:
kind of, for a range of k0 values, eg between 1.844 and 1.708


Well that's easy isn't it, surely you can just scroll down to 1.708 in the sorted list and then to 1.884 and select those? The C value would come with it.

PS I can't do the Perl for you, I don't have it installed here and am not at all good at it anyway :D


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:49 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Bobbyaro wrote:
Edit, er maybe not, I need them to be referenced, so a {k0, C} pairing. if you see what I mean.
Yeah, I mean, three columns -- millisec (for completeness), k0, and C.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:54 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
Ah, I see, I misunderstood.
I wouldn't expect you to do it.
This is getting silly now, I am going to have learn some sort of coding malarky.

_________________
No, it was a giant robot castle!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 11:59 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Bobbyaro wrote:
I wouldn't expect you to do it.
'Sok. I miss Perl :DD


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 12:03 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Evidence of how much I miss Perl: I wrote
Code:
for (int i=0; i<=$max; i+=3) {

and stared dumbfounded at the compile errors.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 12:12 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Bobbyaro wrote:
Ah, I see, I misunderstood.
I wouldn't expect you to do it.
This is getting silly now, I am going to have learn some sort of coding malarky.


Well I'd have given it a shot if I had it installed. It's a good idea to use it occasionally to keep your hand in, so to speak. I fail at that.

PS you might want to post up a bit of the source text file. It would be easier to go source -> perl -> import to xcel and sort
rather than source -> import to excel -> export to CSV -> perl -> import to excel and sort


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 12:16 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
First attempt. First column in that CSV is the value of k0, rows over to the right are all the values of C that correspond to that value of k0.

Second attempt. Simple pairs of {k0,C} sorted by k0. You can grab vertical ranges from that in Excel with a quick formula.

Do either of these solve your problem Bobby? Also, note, you should do some manual error checking to make sure I haven't goofed. I did some debugging as I went along but I make no promises!

Script is here if you are curious.

Edit -- if this is no good, now I've written the parser I can get the data out anyway you like.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 12:20 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Doctor Glyndwr wrote:
First attempt. First column in that CSV is the value of k0, rows over to the right are all the values of C that correspond to that value of k0.

Second attempt. Simple pairs of {k0,C} sorted by k0. You can grab vertical ranges from that in Excel with a quick formula.

Do either of these solve your problem Bobby? Also, note, you should do some manual error checking to make sure I haven't goofed. I did some debugging as I went along but I make no promises!

Script is here if you are curious.

Edit -- if this is no good, now I've written the parser I can get the data out anyway you like.


Oh that sorts it for you too! Of course.
Well done Dr G!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 13:09 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
That's brilliant! Thanks Dr G!
Out of curiosity, what do I need to run Perl? And why did you guys choose Perl over any other language for this?

_________________
No, it was a giant robot castle!


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 13:20 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Perl is kind of built for handling data - check out the script, it's very easy to manipulate if you know what you're doing.

Most other languages you'd be buggering about with arrays of strings and writing your own parsing and sort algorithms.

There are other languages with the same high level functionality though - Ruby is the other one that springs to mind.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 13:22 
User avatar

Joined: 30th Mar, 2008
Posts: 32624
Bobbyaro wrote:
That's brilliant! Thanks Dr G!
You're welcome!

Quote:
Out of curiosity, what do I need to run Perl? And why did you guys choose Perl over any other language for this?
I only really went with Perl because of familiarity (my First Real Job was writing Perl scripts to mangle scientific data, funnily enough). Not sure I'd recommend you start with Perl; it's easy to use for this sort of stuff but can be quite tricky in other ways. Hmm, I'll have a think. Python might be a better bet, which is as powerful as Perl but less idosyncratic.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 13:32 
User avatar
Sleepyhead

Joined: 30th Mar, 2008
Posts: 27354
Location: Kidbrooke
Nice work, nerd-types!

:DD

_________________
We are young despite the years
We are concern
We are hope, despite the times


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 14:46 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
Curiosity wrote:
Nice work, nerd-types!

:DD


Wait 'til you see us in Horde mode.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 14:48 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49244
Doctor Glyndwr wrote:
Evidence of how much I miss Perl: I wrote
Code:
for (int i=0; i<=$max; i+=3) {

and stared dumbfounded at the compile errors.


I like that you are not only nerdy enough to point this out, but also to assume that the rest of us would understand/care.

:DD

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 14:57 
User avatar
UltraMod

Joined: 27th Mar, 2008
Posts: 55719
Location: California
The polite thing would have been to smile and nod, Cras.

_________________
I am currently under construction.
Thank you for your patience.


Image


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 15:00 
User avatar
baron of techno

Joined: 30th Mar, 2008
Posts: 24136
Location: fife
myp wrote:
The polite thing would have been to smile and nod, Cras.


"So, err, d'ya think you'll have it fixed soon Dave? My internet?"


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Fri Feb 06, 2009 15:29 
User avatar
Sleepyhead

Joined: 30th Mar, 2008
Posts: 27354
Location: Kidbrooke
kalmar wrote:
Curiosity wrote:
Nice work, nerd-types!

:DD


Wait 'til you see us in Horde mode.


I have horded with these people. It was terrifying (and wonderful).

_________________
We are young despite the years
We are concern
We are hope, despite the times


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 12:56 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
More help, please.
I have a range in excel sheet. I want to assign it to an array. A range is an array, I just want to say range = array. How do I don this, I have tried:

Code:
    Dim count As Integer
    Dim searchArray(69) As Range
    Dim i As Integer
    Dim value As Variant
    Dim ws As Sheet1
    Dim myRange As Range
   
    Sheets("Issues Log").Select
    Set ws = activeworksheet
    myRange = Range("B8:B76")
           
    Set searchArray() = myRange

and a couple of variations of this, but I can't get it to assign. I comes up with the error message, "can't assign to array".

What am I doing wrong?


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 13:08 
User avatar

Joined: 31st Mar, 2008
Posts: 925
I always had to loop though each cell in the range and place it in the array "manually". This is me just being lazy and not finding out if you could assign a range as an array.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 13:09 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49244
A range isn't an array, it's a collection of cell objects. I'm not sure you can assign it automatically, you may have to iterate through the array something like this:

Code:
i = 0
For each myCell in myRange
searchArray(i) = myCell.value
i=i+1
next

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 13:20 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
I was informed incorrectly from the internetz. I shall do as you suggest. Thanks.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 13:23 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49244
Also change your array declaration to string or integer, whichever your values are.

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 13:23 
User avatar
Part physicist, part WARLORD

Joined: 2nd Apr, 2008
Posts: 13421
Location: Chester, UK
Christ, VB is horrible.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 13:25 
SupaMod
User avatar
Commander-in-Cheese

Joined: 30th Mar, 2008
Posts: 49244
To be fair, VBA hasn't been touched in about 12 years. I really wish they'd bring out a VBA.NET

Bobby, why are you putting range data into an array? A range is a pretty nice data structure of it's own, with lots of lovely built in functions like searching that an array doesn't have.

_________________
GoddessJasmine wrote:
Drunk, pulled Craster's pork, waiting for brdyime story,reading nuts. Xz


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 13:49 
User avatar
Ticket to Ride World Champion

Joined: 18th Apr, 2008
Posts: 11895
I hate excel VBA, it is so poorly structured and cobbled together, plus I have no idea what I am doing!
What I wanted to do was, in poor pseudo code:

range1
rangeLife

where (value in range1 is present in rangeLife) coincident cellColour = Red

pretty simple really, but my knowledge of coding is poor and coloured with C++ and Java, so I keep getting things wrong.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 14:11 
User avatar

Joined: 31st Mar, 2008
Posts: 925
VBA not needed. You can use conditional formatting. On my phone so hard to post an example but try http://www.mrexcel.com/articles/duplica ... atting.php for examples.


Top
 Profile  
 
 Post subject: Re: More Excel Help, Please.
PostPosted: Wed Mar 24, 2010 14:18 
User avatar

Joined: 31st Mar, 2008
Posts: 925
Although it might be better to add another column with

=if(countif(lookup_range,lookup_cell)>0,"X","")

Then you will be able to sort and filter the results.


Top
 Profile  
 
Display posts from previous:  Sort by  
Reply to topic  [ 61 posts ]  Go to page 1, 2  Next

All times are UTC [ DST ]


Who is online

Users browsing this forum: Findus Fop, Mimi, zaphod79 and 0 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search within this thread:
You are using the 'Ted' forum. Bill doesn't really exist any more. Bogus!
Want to help out with the hosting / advertising costs? That's very nice of you.
Are you on a mobile phone? Try http://beex.co.uk/m/
RIP, Owen. RIP, MrC. RIP, Dimmers.

Powered by a very Grim... version of phpBB © 2000, 2002, 2005, 2007 phpBB Group.