+ Reply to Thread
Results 1 to 14 of 14

How to replace dash in a column of numbers with a space and add a prefix

Hybrid View

  1. #1
    Registered User
    Join Date
    05-07-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    How to replace dash in a column of numbers with a space and add a prefix

    Example:

    A1: 51-4001
    It should show in B1: PHM51 4001

    Thanks!

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to replace dash in a column of numbers with a space and add a prefix

    Try
    ="PH"&SUBSTITUTE(A1,"-"," ")

  3. #3
    Registered User
    Join Date
    05-07-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to replace dash in a column of numbers with a space and add a prefix

    Thank you. It sort of worked. Here's what displays in B1:PHMVendor Part Number
    But when I drag the cell down to B2 it shows the right info but in the wrong cell:PHM51 4001
    How can I make it work to display the right info instead of the PHMVendor Part Number verbage?

  4. #4
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to replace dash in a column of numbers with a space and add a prefix

    Make sure calculation is set to Automatic.

  5. #5
    Registered User
    Join Date
    05-07-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to replace dash in a column of numbers with a space and add a prefix

    Not sure how to set it to Automatic. Please advise.

  6. #6
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to replace dash in a column of numbers with a space and add a prefix

    On the Formulas Tab, near the Far Right side is "Calculation Options"
    Click that and choose "Automatic"

  7. #7
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: How to replace dash in a column of numbers with a space and add a prefix

    it is a setting under options in the file tab, click file tab, options>>formulas>> under calculation options it should be checked to automatic, not manual.
    Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
    Sam Capricci

  8. #8
    Registered User
    Join Date
    05-07-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to replace dash in a column of numbers with a space and add a prefix

    I just checked and it was already set on automatic. I was hoping I could send a screen shot but it won't allow me to. Maybe there's another setting that's off?

  9. #9
    Forum Expert Sam Capricci's Avatar
    Join Date
    06-14-2012
    Location
    Palm Harbor, Florida
    MS-Off Ver
    16.95 for Mac MS 365
    Posts
    8,682

    Re: How to replace dash in a column of numbers with a space and add a prefix

    I tried Jonmo1's formula and other than missing the "M" in the formula it appears to nail it for you given what you wrote in the first post.
    ="PHM"&SUBSTITUTE(A1,"-"," ") when you write PHMVendor Part Number what exactly do you mean?

  10. #10
    Registered User
    Join Date
    05-07-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to replace dash in a column of numbers with a space and add a prefix

    Thanks. I did notice that also before I entered the formula and made the change to add the M and those were my results.
    For some reason it gives me the PHMVendor Part Number in that cell instead of the correct data that displays when I drag the cell down.

  11. #11
    Registered User
    Join Date
    05-07-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to replace dash in a column of numbers with a space and add a prefix

    I just realized why it didn't work. I was in a spreadsheet created by another user with some restrictions in it. When I copied the data over to a blank spreadsheet it worked. But now I need to know how to copy this formula to the cells below it. The numbers are random numbers - not in a particular order.
    For example:
    54-3500
    53-3402
    Thanks.

  12. #12
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to replace dash in a column of numbers with a space and add a prefix

    Perhaps A1 is a header, and you really want to refer to A2

    ="PHM"&SUBSTITUTE(A2,"-"," ")

  13. #13
    Registered User
    Join Date
    05-07-2014
    Location
    California, US
    MS-Off Ver
    Excel 2010
    Posts
    13

    Re: How to replace dash in a column of numbers with a space and add a prefix

    Thanks all. I just figured it out. When I inserted a header row above the cells with data dropped the formula as a header in B1 - then dragged the cells down - it displays the correct data for each cell. Thanks for your help!

  14. #14
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How to replace dash in a column of numbers with a space and add a prefix

    You're welcome.

+ 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. Space between text and dash
    By tantcu in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 10-04-2013, 01:36 PM
  2. [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
  3. VBA code-file name replace dash with space
    By vargs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2010, 03:22 PM
  4. [SOLVED] prefix a column of numbers with combination of zeros
    By pinny in forum Excel General
    Replies: 2
    Last Post: 07-31-2006, 11:48 AM
  5. Adding a prefix to all numbers in a column.
    By Randy in forum Excel General
    Replies: 2
    Last Post: 02-05-2006, 05:00 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