+ Reply to Thread
Results 1 to 13 of 13

insert text in front of Text OR number - user defined format

  1. #1
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82

    insert text in front of Text OR number - user defined format

    Hi,

    Sorry if the question is a bit simple but I got stuck with this problem:
    I can't seem to make user-defined format that puts a text in front of a number and/or a text.
    Let's say I have A1: 13, A2: texttext A3: text7 and I want to format a lot of cells to "Ilike 13" / "Ilike texttext" / "Ilike text7"... ie add the same text in the front of the cell, no matter what the content is.
    I did manage it seperately, with "texttext" @ for text and "texttext" # for numbers, but what's the general one ?
    Sorry again if too simple, just can't figure it out.
    Last edited by VBA Noob; 10-03-2008 at 09:05 AM.

  2. #2
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    Can't you just format your cells to TEXT, then enter your contents, whether its a NUMBER or TEXTNUMBER
    oldchippy
    -------------


    Blessed are those who can give without remembering and take without forgetting

    If you are happy with the help you have received, please click the <--- STAR icon on the left - Thanks.

    Click here >>> Top Excel links for beginners to Experts

    Forum Rules >>>Please don't forget to read these

  3. #3
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    that's what I've been trying to do, but sometimes I have dates as well, ie DD/MM/YYYY, and I can't just convert it to text properly and leave it like that... And if I format simple numbers to text, and then make a user-defined format: "blabla" @ it still just works with text (or number..)

  4. #4
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Can you post a zip copy of your spreadsheet with some examples together with the result you require?

  5. #5
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    I can't give the original sheet as it's from my business, but here what I need:

    edit: Well, basically it's quite simple: a format that is is both "text" @, "text" # and "text" DD/MM/YYYY
    Attached Files Attached Files
    Last edited by Simon-ch; 09-24-2008 at 08:42 AM.

  6. #6
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    You could use this in B2

    =IF(CELL("format",A2)="D1","This is: "&TEXT(A2,"dd/mm/yyyy"),"This is: "&A2) and copy down

  7. #7
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Just to add but may not be the solution for your problem

    Custom formats

    Number
    "this is: "General
    Date
    "this is: " dd.mm.yyyy
    Text
    "this is: "@
    VBA Noob
    _________________________________________


    Credo Elvem ipsum etian vivere
    _________________________________________
    A message for cross posters

    Please remember to wrap code.

    Forum Rules

    Please add to your signature if you found this link helpful. Excel links !!!

  8. #8
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    @oldchippy:
    Thanks, but I was trying to solve this with an easy format, so I can just reproduce it whenever I need it (often)
    @VBA noob: That's exactly what I have been using to date, but I would need a universal one, because I have a lot of custom entries, eg; 13/07/2008 or 2005 or "date unknown" etc etc... So I could just select all and use one format to add a text in front of it.

  9. #9
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Hi,

    May be this will help?
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    It does help, thank you, but I was looking for an easier way to do it actually.
    Just thought there might be some way to do it directly, like combining different formats (ie text, date, numbers)

  11. #11
    Forum Expert oldchippy's Avatar
    Join Date
    02-14-2005
    Location
    Worcester, UK
    MS-Off Ver
    Excel 2007 (Home)
    Posts
    7,097
    Not as a "General" excel format, but may be with VBA but I'm afraid that not my expertice - sorry

  12. #12
    Forum Contributor VBA Noob's Avatar
    Join Date
    04-25-2006
    Location
    London, England
    MS-Off Ver
    xl03 & xl 07(Jan 09)
    Posts
    11,988
    Press Alt + F11 > Insert a module and paste in the below. Close VB editor then press Alt F8 then run FormatCells

    Please Login or Register  to view this content.
    VBA Noob

  13. #13
    Registered User
    Join Date
    09-18-2008
    Location
    Switzerland
    MS-Off Ver
    Office 2003
    Posts
    82
    Excellent, sorry for my late reply but this works perfectly !

+ 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. How to display help text in the Insert function wizard (Excel)
    By sudhakard in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 01-26-2009, 11:01 AM
  2. Number format issue
    By LPorter in forum Excel General
    Replies: 1
    Last Post: 09-23-2008, 05:39 AM
  3. Formating columns to currency, text, number
    By Dave32 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 09-12-2008, 07:35 PM
  4. Replies: 6
    Last Post: 07-29-2008, 03:23 PM
  5. web service call from user defined function
    By parm in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 01-17-2007, 12:03 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