+ Reply to Thread
Results 1 to 9 of 9

How to round a number off when contained in text

  1. #1
    Registered User
    Join Date
    01-04-2017
    Location
    Sydney
    MS-Off Ver
    x7
    Posts
    3

    How to round a number off when contained in text

    I have a table with data in it where significance testing has been completed. The relevant cells look like:
    0.113(*)

    I want to round the number portion of the cell, whilst still keeping the asterisk (denoting that the result was significant), so that the cell will look like this:
    0.11*

    I was wondering if there was a formula to do this? The tricky part I am finding is the rounding off (i.e., the removal of the parentheses I can do by finding/replacing them).

  2. #2
    Forum Contributor
    Join Date
    06-28-2016
    Location
    Pennsylvania, USA
    MS-Off Ver
    2013
    Posts
    308

    Re: How to round a number off when contained in text

    if it is literally parenthesis, you can do it utilizing the find function and round function, no matter the amount of numbers (if it is all with number first like that).

    It would help if you give sample data first though, because you can possibly solve this with simple left/right instead of a bunch of nested find making it hard to follow what's going on in the formula.

  3. #3
    Registered User
    Join Date
    01-04-2017
    Location
    Sydney
    MS-Off Ver
    x7
    Posts
    3

    Re: How to round a number off when contained in text

    The data looks like this:

    Data .jpg

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to round a number off when contained in text

    If you do indeed have something like 0.113(*) in a cell, then that is no longer a number, it is text. Where does that come from?
    I suggest that you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to round a number off when contained in text

    If you do indeed have something like 0.113(*) in a cell, then that is no longer a number, it is text. Where does that come from?
    I suggest that you upload a small (clean) sample workbook (not a pic) of what you are working with, and what your expected outcome would look like.

  6. #6
    Forum Guru
    Join Date
    02-27-2016
    Location
    Vietnam
    MS-Off Ver
    2016
    Posts
    5,907

    Re: How to round a number off when contained in text



    =IFERROR(ROUND(LEFT(A1,FIND("(",A1)-1)+0,2)&REPT("*",LEN(A1)-LEN(SUBSTITUTE(A1,"*",""))),ROUND(A1,2))

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

    Re: How to round a number off when contained in text

    Going by your example, if you just want to truncate the number rather than rounding it, then you can do it with one operation using Find & Replace (CTRL-H).

    Select all the cells, then CTRL-H, and:

    Find what: ?(
    Replace with: (
    Click Replace All

    the ?( characters stand for a single character in front of the open bracket, and replace that with a single bracket.

    Hope this helps.

    Pete

  8. #8
    Registered User
    Join Date
    01-04-2017
    Location
    Sydney
    MS-Off Ver
    x7
    Posts
    3

    Re: How to round a number off when contained in text

    Thanks for the code: =IFERROR(ROUND(LEFT(A1,FIND("(",A1)-1)+0,2)&REPT("*",LEN(A1)-LEN(SUBSTITUTE(A1,"*",""))),ROUND(A1,2))

    It solved the problem.

  9. #9
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,929

    Re: How to round a number off when contained in text

    Based on your last post it seems that you are satisfied with the solution(s) you've received but you haven't marked your thread as SOLVED. If your problem has not been solved you can use Thread Tools (located above your first post) and choose "Mark this thread as unsolved".
    Thanks.

    Also, as a relatively new member of the forum, you may not be aware that you can thank those who have helped you by clicking the small star icon located in the lower left corner of the post in which the help was given. By doing so you can add to the reputation(s) of those who helped.

+ 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. Replies: 2
    Last Post: 12-06-2014, 01:58 PM
  2. [SOLVED] If cell contains text contained in a named range return the row number
    By spoursy in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 08-05-2014, 05:54 AM
  3. Sum if a number is contained in a list
    By pauldaddyadams in forum Excel General
    Replies: 8
    Last Post: 12-03-2013, 02:30 PM
  4. [SOLVED] Return specific text if a different text is contained anywhere in a range of cells
    By ciayers in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-06-2013, 05:54 PM
  5. [SOLVED] Identify if a number is contained within 40 or more number ranges
    By HealthyB in forum Excel General
    Replies: 5
    Last Post: 02-10-2013, 08:22 PM
  6. Replies: 7
    Last Post: 02-03-2011, 01:12 PM
  7. Replies: 6
    Last Post: 03-07-2008, 03:40 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