+ Reply to Thread
Results 1 to 6 of 6

How do I use string values in a cell to do calculations?

Hybrid View

  1. #1
    Registered User
    Join Date
    10-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Question How do I use string values in a cell to do calculations?

    Thanks in advance for help with this. I have a very large spreadsheet, 20,000+ rows, with a list of chemical formulas and I would like to calculate the molecular weights based on the chemical formula. For example, the cell contains the string "CH4" (without the quotes) and I would like to use this information to calculate the molecular weight by adding the mass of 1 carbon (C) and 4 hydrogens (H), or 12.0107 + (4 x 1.0079) = 16.0423. I can certainly do the equations, but I have no clue as to how I pull out the information in a string in a cell. It can get very complicated, such as C7H3ClF3NO2, with some of the constituents having 2 letters, like Cl, and some having only 1, as well as components with only one atom present are not followed with a 1, like N, but those with more than one atom, like C, will have the count, 7, listed after the symbol.

    Thanks again!:confuse

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How do I use string values in a cell to do calculations?

    Like https://www.lenntech.com/calculators...calculator.htm ar https://www.bocsci.com/molecular-weight-calculator.html ?
    Last edited by shg; 11-27-2018 at 11:38 AM.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    10-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: How do I use string values in a cell to do calculations?

    That is exactly what I want to do, but I don't have time to do it 20,000 times.
    Last edited by Jowaco; 11-27-2018 at 11:43 AM. Reason: Misunderstood reply

  4. #4
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2406
    Posts
    44,434

    Re: How do I use string values in a cell to do calculations?

    Try this:

    https://excelxor.com/2016/03/07/molecular-weights/

    XOR LX, one of our regular gurus loves these complex formulae, as you will see when you D/L the sheet...
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU

  5. #5
    Registered User
    Join Date
    10-24-2013
    Location
    United States
    MS-Off Ver
    Excel 2010
    Posts
    4

    Re: How do I use string values in a cell to do calculations?

    Thanks!!! Now I just have to figure out how to manipulate this to calculate everything in my list.

  6. #6
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2003, 2010
    Posts
    40,678

    Re: How do I use string values in a cell to do calculations?

    Someone might be able to help you automate Explorer to do that.

+ 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. Script to Search for a specific String then return cell values above that String-4
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-03-2015, 01:28 AM
  2. [SOLVED] Script to Search for a specific String then return cell values above that String-3
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-01-2015, 01:50 PM
  3. [SOLVED] Script to Search for a specific String then return cell values above that String-2
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-01-2015, 01:00 PM
  4. [SOLVED] Script to Search for a specific String then return cell values above that String
    By owensjb2 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-01-2015, 11:28 AM
  5. Replies: 2
    Last Post: 12-29-2014, 11:24 PM
  6. Replies: 5
    Last Post: 11-08-2012, 03:38 PM
  7. Replies: 0
    Last Post: 10-10-2012, 10:11 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