+ Reply to Thread
Results 1 to 9 of 9

Trying to get a text string along with a formula

  1. #1
    Registered User
    Join Date
    06-03-2020
    Location
    Toronto
    MS-Off Ver
    MS2019
    Posts
    9

    Question Trying to get a text string along with a formula

    Hi All,

    I am trying to get a text string along with the formula to show up.

    For example, Cell A1=10 and Cell B1=10, when we subtract A1-B1, the end result of the formula I need is, "0, No variance"

    or

    Cell A1=10 and Cell B1=8, when we subtract A1-B1, the end result of the formula I need is, "2, Variance"

    I need the difference between the cells appearing along with the text string of variance if there is a difference or no variance if there is no difference between the two cells.

    Appreciate the help and thanks in advance!
    Last edited by calvn; 06-04-2020 at 06:54 PM.

  2. #2
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Trying to get a text string along with a formula

    One way
    Formula: copy to clipboard
    Please Login or Register  to view this content.
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


  3. #3
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,801

    Re: Trying to get a text string along with a formula

    Welcome to the forum.

    Try this:

    =IF(A1-B1=0,"0, No Variance",A1-B1&”, Variance")
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  4. #4
    Registered User
    Join Date
    06-03-2020
    Location
    Toronto
    MS-Off Ver
    MS2019
    Posts
    9

    Re: Trying to get a text string along with a formula

    Thank you so much for the help! The formula is working great. How do I edit the formula to ensure that the variance amount is formatted to "xxx,xxx".

  5. #5
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Trying to get a text string along with a formula

    Alternatively, you can use a custom number format to put text in the cell while retaining the actual value for other calculations:
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Ben Van Johnson

  6. #6
    Registered User
    Join Date
    06-03-2020
    Location
    Toronto
    MS-Off Ver
    MS2019
    Posts
    9

    Re: Trying to get a text string along with a formula

    Thank you so much for the help! The issue I am facing with custom number is that I having to set the format when I copy the formula. Is there anyway to modify that?

    Appreciate your help!

  7. #7
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,610

    Re: Trying to get a text string along with a formula

    If you drag the cell with the formula/format, the format goes along. If you are doing copy/paste, just use paste special, formulas & number formats. I just tried it by copying to a new sheet...

  8. #8
    Registered User
    Join Date
    06-03-2020
    Location
    Toronto
    MS-Off Ver
    MS2019
    Posts
    9

    Re: Trying to get a text string along with a formula

    That works thank you so much!

  9. #9
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    44,434

    Re: Trying to get a text string along with a formula

    You're welcome. Thanks for the rep.



    If you are satisfied with the solution(s) provided, please mark your thread as Solved.


    New quick method:
    Select Thread Tools-> Mark thread as Solved. To undo, select Thread Tools-> Mark thread as Unsolved.

    Or you can use this way:

    How to mark a thread Solved
    Go to the first post
    Click edit
    Click Go Advanced
    Just below the word Title you will see a dropdown with the word No prefix.
    Change to Solved
    Click Save


    You may also want to consider thanking those people who helped you by clicking on the little star at the bottom left of their reply to your question.

+ 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: 05-27-2016, 12:30 AM
  2. Replies: 2
    Last Post: 11-18-2014, 06:26 AM
  3. Formula to find and return text string within a cell full of text strings
    By LightingPop in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 12-03-2013, 11:45 PM
  4. [SOLVED] Extract text from a string of text (amend formula to include new criteria)
    By robertguy in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-10-2013, 04:53 PM
  5. [SOLVED] Find partial text string within another text string return original text into cell.
    By mikey42979 in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 06-17-2013, 02:58 PM
  6. [SOLVED] Highlight a portion of string text (the string text is a value of a formula)
    By RaymondH in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-02-2012, 06:50 AM

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