+ Reply to Thread
Results 1 to 7 of 7

Replace text to number with conditional formatting

  1. #1
    Registered User
    Join Date
    07-27-2015
    Location
    Canada
    MS-Off Ver
    15.0.4
    Posts
    33

    Replace text to number with conditional formatting

    First post - thanks in advance for helping out.

    I have a spreadsheet that automatically feeds in values from an external database. I'd like to replace any incoming cells of "#N/A N/A" with "0," and I can't apply any formula to the specific cell because the data import overwrites it with either a numerical value of "#N/A N/A." Please note: this isn't an Excel derived error, but a text-based error message inputted from the database. Excel doesn't recognize it as anything other than a string of arbitrary letters.

    I've figured out how to do the opposite: I click conditional formatting, apply new rule, and use a formula to determine which cells to format. I input =A1=0, and the go to custom format and enter [=0]"#N/A N/A" . This works - if I enter a "0," I end up with my text. I'd like to do something like this, but the other way around.

    Any ideas?

    Best.

  2. #2
    Registered User
    Join Date
    09-08-2010
    Location
    Montenegro
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Replace text to number with conditional formatting

    Quote Originally Posted by MontrealMTL View Post
    I have a spreadsheet that automatically feeds in values from an external database.
    How does it "Automatically feed", via formula? Let's say, if that external database is in sheet "Sheet1" of file "Database", you have formula like this:

    =[Database.xlsx]Sheet1!A1

    where A1 is just any cell you take the data from?

    If so, configure the formula this way:

    =IF([Database.xlsx]Sheet1!A1="#N/A N/A";0;[Database.xlsx]Sheet1!A1)

    That way, if cell content in external database is "#N/A N/A", it will get replaced with zero, otherwise, it will remain unchanged. Please note this works only if "#N/A N/A" is actual cell content in external database, and not caused by calculation error (which I understood is case), and check if argument separator in your Excel is semicolon (as I use) or colon.

  3. #3
    Registered User
    Join Date
    07-27-2015
    Location
    Canada
    MS-Off Ver
    15.0.4
    Posts
    33

    Re: Replace text to number with conditional formatting

    Hi Froment, thanks for you reply.

    The Excel doc has a formula that pulls from a non-Excel database. Would this still work?

    Many thanks.

  4. #4
    Registered User
    Join Date
    07-27-2015
    Location
    Canada
    MS-Off Ver
    15.0.4
    Posts
    33

    Re: Replace text to number with conditional formatting

    Further clarification: The formula generates custom data from a subscription database. I enter it in, and the formula links with keywords in columns that tell it which data to find and place underneath the keyword.

  5. #5
    Registered User
    Join Date
    09-08-2010
    Location
    Montenegro
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Replace text to number with conditional formatting

    Well, then it's beyond my abilities, sorry. I thought both source and destination files were Excel ones...

  6. #6
    Registered User
    Join Date
    07-27-2015
    Location
    Canada
    MS-Off Ver
    15.0.4
    Posts
    33

    Re: Replace text to number with conditional formatting

    No worries - thank you for trying.

    The only thing I can think of would be to find a way to have conditional formatting replace all #N/A N/A with 0, or have a new sheet with a substitute or IF function copy the data and replace any #N/A N/A with 0. This file will be unimaginably large, however, if I do the latter. I appreciate all cracks at it!

  7. #7
    Registered User
    Join Date
    09-08-2010
    Location
    Montenegro
    MS-Off Ver
    Excel 2010
    Posts
    82

    Re: Replace text to number with conditional formatting

    Well, as far as I know, you cannot just replace the content by conditional formatting, you would have to use macros to accomplish that.

    As for the idea for another sheet, you're right that it would duplicate the size of the workbook, but I don't see other issues, and in that case I believe my idea above would work - you feed one sheet as usual, and then you add another sheet, just linking the same cells with the formula above, i.e., if raw data is in Sheet1, then in Sheet2, cell A1 reads:

    =IF(Sheet1!A1="#N/A N/A";0;Sheet1!A1)

    and then copy accross the sheet, as far as you have the data.

    Again, "#N/A N/A" would have to be the actual cell content; otherwise, if it's calculation produced formula, use

    =IF(ISERROR(Sheet1!A1);0;Sheet1!A1)

+ 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: 04-10-2015, 12:12 PM
  2. Conditional Formatting, Excel 2010, based on number of a certain text value in a range
    By trueimperfection in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 04-02-2014, 06:55 AM
  3. [SOLVED] Conditional formatting multiple number values but IGNORING text.
    By Dazmeister in forum Excel General
    Replies: 14
    Last Post: 09-06-2013, 09:02 AM
  4. Conditional Formatting where text in another cell translate to a number
    By tstaller in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 11-05-2012, 12:52 PM
  5. Excel 2007 : Conditional Formatting: Replace Text
    By madracer in forum Excel General
    Replies: 9
    Last Post: 03-02-2011, 11:20 AM
  6. [SOLVED] Conditional Formatting - Replace #N/A with text
    By NickPDC in forum Excel General
    Replies: 2
    Last Post: 01-11-2011, 10:50 AM
  7. [SOLVED] Conditional formatting for text to number
    By Jason in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-19-2006, 04:40 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