+ Reply to Thread
Results 1 to 5 of 5

Conditional formatting by formula or VB code

  1. #1
    Registered User
    Join Date
    06-09-2011
    Location
    Leeds, UK
    MS-Off Ver
    MS Office 2016
    Posts
    77

    Wink Conditional formatting by formula or VB code

    Hi ExcelGURUs,

    I have a spreadsheet where lots of conditional formatting are required.
    I want to do it using formula or VB code. For example in A column I have both number and text value (each value is coming from a vlookup formula from a diff tab of the same spreadsheet). I want to highlight only the numbers with a different colour.

    If anyone can help me with this….I can try the other requirements.

  2. #2
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional formatting by formula or VB code

    Select the column A range and go to Format|Conditional Formatting, select Formula Is from drop down menu and enter formula: =ISNUMBER(A1+0)

    Click Format and select colour from the Pattern tab.

    Click Ok
    Click Ok to finish.
    Where there is a will there are many ways.

    If you are happy with the results, please add to the contributor's reputation by clicking the reputation icon (star icon) below left corner

    Please also mark the thread as Solved once it is solved. Check the FAQ's to see how.

  3. #3
    Registered User
    Join Date
    06-09-2011
    Location
    Leeds, UK
    MS-Off Ver
    MS Office 2016
    Posts
    77

    Re: Conditional formatting by formula or VB code

    Thanks. This is working but 1 problem...it is highlighting the blank cell also…I don’t want the blank cell to be highlighted.

  4. #4
    Forum Expert
    Join Date
    12-23-2006
    Location
    germany
    MS-Off Ver
    XL2003 / 2007 / 2010
    Posts
    6,326

    Re: Conditional formatting by formula or VB code

    Same method as NBVC but try =isnumber($a1)

  5. #5
    Forum Expert NBVC's Avatar
    Join Date
    12-06-2006
    Location
    Mississauga, CANADA
    MS-Off Ver
    2003:2010
    Posts
    34,898

    Re: Conditional formatting by formula or VB code

    I added the +0, because usually when there is a mix of text and numbers, it could be that the numbers are text formatted.. the +0 forces the number to be a number, if indeed it has not alpha characters in it.... so arthurbr's method may or may not work...

    or you can try: =AND(A1<>"",ISNUMBER(A1+0))

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

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