+ Reply to Thread
Results 1 to 6 of 6

Finding all similar values in a spreadsheet

  1. #1
    Registered User
    Join Date
    08-12-2014
    Location
    Gold Coast, Australia
    MS-Off Ver
    Office 2013
    Posts
    4

    Finding all similar values in a spreadsheet

    Hi everyone, I apologize for the lengthy post but I'm afraid I may need to explain this fairly well.

    I am a chemistry student and what I am trying to do is to determine how the chemical composition of a number of plants varies -- i.e. how they are similar and how they are different. Chemical composition is defined by the molecules present, and these molecules are labelled as their molecular weight and their corresponding retention time (how long they took to "appear"). So my lists look like this:

    Sample 1

    Mass / Retention time
    850.2138 / 4.437
    436.0981 / 4.437
    234.0526 / 4.438

    Sample 2

    Mass / Retention time
    850.2144 / 4.44
    414.1162 / 4.441
    463.1692 / 6.444

    ... and these list go on for about 150-200 molecules, and I have 10 samples. So all in all, I have around 1500-2000 values.

    What I need to do is to develop a presence and absence table where in the left hand column I have each compound (their molecular weight and retention time) and along each row I have a "1" (if present) or "0" (if absent) for each sample. So it could look like this

    Molecule Sample 1 Sample 2 Sample 3

    850.2144 /4.44 1 1 0
    414.1162 / 4.441 0 1 1

    Etc.

    So basically, what I need to do, is make a list along the left hand column of every UNIQUE compound that appears and then in the next 10 columns, mark whether that compound appears in each particular sample. This in itself is a hard enough task, however the problem gets a little harder when we have to account for the fact that most of the time, the same compound will appear in a different sample with a slightly different molecular weight (i.e. it may appear as 850.2144 / 4.44 in one sample and 850.2138 / 4.437 in another).

    I really don't want to have to go through this huge spreadsheet manually and do this -- does anyone have any advice for me? If i haven't posted in the right forum or if my problem is difficult to understand please let me know.

    Thanks.

  2. #2
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Finding all similar values in a spreadsheet

    How are your samples data plotted in the file? It would be good if you can provide a sample file.

    Also, about "detecting" similar values, there should also be a threshold maintained (i.e. +- 0.01 would be considered the same). An additional column indicating the "grouped" molecule would be good too (i.e. 850.2144 / 4.44 and 850.2138 / 4.437 grouped under molecule "1").
    多么想要告诉你 我好喜欢你

  3. #3
    Registered User
    Join Date
    08-12-2014
    Location
    Gold Coast, Australia
    MS-Off Ver
    Office 2013
    Posts
    4

    Re: Finding all similar values in a spreadsheet

    Samples 1-10.xlsxHi, I am currently attempting to upload the file -- I seem to be having a bit of trouble! I think this worked

    EDIT: Yes it seemed it worked. The data should be on spreadsheet #2 (called Data 2). Each column is:

    1st: molecular mass
    2nd: retention time (sorted by lowest to highest)
    3rd: the volume of the compound (i.e. how abundant it is)
    4th: volume of that molecule divided by the volume of the most abundant molecule in the sample

    The last 2 columns arent as important right now
    Last edited by robertson92; 08-12-2014 at 10:44 PM.

  4. #4
    Forum Expert millz's Avatar
    Join Date
    08-14-2013
    Location
    Singapore
    MS-Off Ver
    Excel, Access 2016
    Posts
    1,694

    Re: Finding all similar values in a spreadsheet

    Try running this code on the data worksheet. I have also added a button on the worksheet that runs the code -- in case you have no idea how to run it.

    Two new worksheets will be added. First is the rearranged data of all your samples, together with an "ID" tagged to each "unique" molecule. Second worksheet will be plotting the presence of each molecule in each sample. I've set the threshold for similar molecules purely by looking at your values only, you can amend it accordingly if it's not accurate.

    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by millz; 08-13-2014 at 12:07 AM.

  5. #5
    Registered User
    Join Date
    08-12-2014
    Location
    Gold Coast, Australia
    MS-Off Ver
    Office 2013
    Posts
    4

    Re: Finding all similar values in a spreadsheet

    Wow. You are, without a doubt, the most amazing person I have ever met on the internet. Thank you SO much.

  6. #6
    Registered User
    Join Date
    08-12-2014
    Location
    Gold Coast, Australia
    MS-Off Ver
    Office 2013
    Posts
    4

    Re: Finding all similar values in a spreadsheet

    Can I send you some money for this? If you send me your PayPal details I could forward through some money for your time. This is amazing.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Finding similar values in a seperate cloumn
    By belapds in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 09-17-2012, 09:19 AM
  2. Finding similar but not identical values using COUNT and COUNTIF
    By krixtoffer in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-25-2011, 05:44 AM
  3. Finding similar, but not identical values in two-dimensional datasets
    By krixtoffer in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-24-2011, 04:51 PM
  4. Finding similar values in chart
    By Bshafer1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-07-2011, 05:11 PM
  5. Comparing two lists and finding 'similar' values
    By johncassell in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 11-09-2010, 09:29 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1