+ Reply to Thread
Results 1 to 6 of 6

Rounding Numbers after a cancatenation of two numbers with a hyphen

  1. #1
    Registered User
    Join Date
    03-11-2015
    Location
    Maine
    MS-Off Ver
    2013
    Posts
    2

    Rounding Numbers after a cancatenation of two numbers with a hyphen

    Hello Everyone!

    I have confidence intervals that I concatenated into single cells so that they read "lowCI-upperCI" and I would like to round the lower and upper confidence intervals while keeping the hyphen. Is there a formula I can use to do this? If not is there some VBA code that could help?

    For example:

    I have: "16.6226-19.1051"

    And I want: "16.6-19.1"

    Thank you!

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

    Re: Rounding Numbers after a cancatenation of two numbers with a hyphen

    Hi there... and welcome to the Excel Forum. Try htis out:

    =ROUND(LEFT(A1,FIND("-",A1)-1)+0,1)&"-"&ROUND(MID(A1,FIND("-",A1)+1,255)+0,1)

    assuming your numerical string is in A1
    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.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

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

    Re: Rounding Numbers after a cancatenation of two numbers with a hyphen

    Here's a couple of ways:

    =ROUND(A1,1)&"-"&ROUND(B1,1)

    or:

    =TEXT(A1,"0.0")&"-"&TEXT(B1,"0.0")

    assuming your values are in A1 and B1.

    Hope this helps.

    Pete

  4. #4
    Registered User
    Join Date
    03-11-2015
    Location
    Maine
    MS-Off Ver
    2013
    Posts
    2

    Re: Rounding Numbers after a cancatenation of two numbers with a hyphen

    Thank you Glen and Pete!

    Glen, you code worked perfectly! And thanks for the welcome!

    Pete, thank you for your post aswell. I should have specified clearer that the hyphened number was in a single cell!

    Really appreciate the expedited responses!!

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

    Re: Rounding Numbers after a cancatenation of two numbers with a hyphen

    You're welcome... and thanks for the Rep...

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

    Re: Rounding Numbers after a cancatenation of two numbers with a hyphen

    Yes, my formulae are to replace your concatenation formula.

    Thanks for the rep, though.

    Pete

+ 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. Insert hyphen/dash in the middle of numbers
    By noxious in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-08-2015, 10:19 PM
  2. Need to add numbers on either side of a hyphen
    By shermah in forum Excel General
    Replies: 4
    Last Post: 04-09-2015, 01:14 AM
  3. Remove numbers followed by hyphen in text column
    By grantman7 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 02-23-2015, 11:54 PM
  4. [SOLVED] Changing text into numbers and a hyphen
    By seannydj in forum Excel General
    Replies: 2
    Last Post: 07-27-2013, 01:23 PM
  5. [SOLVED] Macro / VBA to replace space between numbers with a hyphen
    By chicolocal in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-03-2013, 03:59 PM
  6. hyphen between numbers
    By jgomez in forum Excel General
    Replies: 1
    Last Post: 12-27-2010, 10:53 PM
  7. [SOLVED] many numbers in one cell separated by hyphen.
    By baju in forum Excel General
    Replies: 7
    Last Post: 02-09-2005, 11:06 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