+ Reply to Thread
Results 1 to 6 of 6

Convert to Num only then Subtract 4.00 (cm) from 2.70 (cm)

Hybrid View

  1. #1
    Registered User
    Join Date
    08-08-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2007
    Posts
    11

    Convert to Num only then Subtract 4.00 (cm) from 2.70 (cm)

    Hi

    I have two columns with the data like below:

    4.00 (cm) 2.70 (cm)
    2.20 (cm) 2.20 (cm)
    4.00 (cm) 4.00 (cm)
    2.20 (cm) 2.20 (cm)
    3.00 (cm) 4.60 (cm)
    4.50 (cm) 4.50 (cm)
    4.60 (cm) 3.00 (cm)
    2.90 (cm) 2.90 (cm)
    5.00 (cm) 5.00 (cm)


    Can you please help me:
    1) I want to extract numbers from these columns to another two columns

    2) Then I want to subtract two columns to get the distance.

    Thanks a ton
    Harkirat

  2. #2
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Convert to Num only then Subtract 4.00 (cm) from 2.70 (cm)

    Assuming:
    A1 = "4.00 (cm)"
    B1 = 2.70 (cm)"

    Then:
    C1 = VALUE( LEFT(A1, FIND("(", A1, 1) - 1) )
    //Find the left paren, clip off everything from there to the right, convert what's left to a number,
    D1 = VALUE( LEFT(B1, FIND("(", B1, 1) - 1) )
    //Ditto for the second column

    E1 = ABS(C1 - D1)
    This will return the absolute value of the difference, so it will always be positive, ie
    abs(2.7 - 4) = 1.3 not -1.3

  3. #3
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,421

    Re: Convert to Num only then Subtract 4.00 (cm) from 2.70 (cm)

    Another way of converting the numbers in C1:

    =SUBSTITUTE(A1,"(cm)","")*1

    Copy into D1, then copy both down.

    Hope this helps.

    Pete

  4. #4
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,156

    Re: Convert to Num only then Subtract 4.00 (cm) from 2.70 (cm)

    hi Harkirat. try:
    =--LEFT(A1,FIND(" ",A1)-1)

    you can just take the above result minus the other after copying the formula

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  5. #5
    Registered User
    Join Date
    08-08-2013
    Location
    Edinburgh
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Convert to Num only then Subtract 4.00 (cm) from 2.70 (cm)

    Thanks a lot guys it worked!
    I liked Pete's formula more, short and simple.
    Last edited by harkirat777; 10-31-2013 at 11:29 AM.

  6. #6
    Forum Expert ben_hensel's Avatar
    Join Date
    01-26-2012
    Location
    Northeast USA
    MS-Off Ver
    Office 365
    Posts
    2,043

    Re: Convert to Num only then Subtract 4.00 (cm) from 2.70 (cm)

    You can copy it down.

    Easiest way... select the cell C1,hover the cursor over the bottom right corner so it turns into that little all-black cross, then double-click. The column will fill down each row as long as there's something to the left of it.

    ...If it was me, I would also do a dummy column that did
    =ISERROR(SEARCH(A1,"cm",1)+SEARCH(B1,"cm",1))
    and then filter for "TRUE" to check for unit clashes.

+ 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. [SOLVED] convert decimal number to time : convert 1,59 (minutes, dec) to m
    By agenda9533 in forum Excel General
    Replies: 22
    Last Post: 09-15-2013, 10:43 AM
  2. Replies: 2
    Last Post: 08-13-2013, 09:36 AM
  3. If Sat subtract one day, if Sunday subtract tow days
    By Wskip49 in forum Excel General
    Replies: 3
    Last Post: 06-30-2012, 03:35 PM
  4. Replies: 1
    Last Post: 01-27-2012, 11:25 PM
  5. [SOLVED] Convert month to number and subtract one
    By Deeds in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-02-2005, 05:50 PM

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