+ Reply to Thread
Results 1 to 9 of 9

Changing the order of text based on results

  1. #1
    Forum Contributor
    Join Date
    12-12-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    448

    Changing the order of text based on results

    Hello. I've attached a spreadsheet. I want the order of the sentence to change based on the numbers and whether they are positive or negative. Below are more details and the spreadsheet has numbers. Thanks



    "Total expense for September was 8 higher (lower) than prior year, driven by a higher (lower) claims expense and admin expense"


    This might be hard to explain: For the second part (starting from "driven by", I would like the variable that explains more of the positive or negative variance (in the example, claims) to come first.

    Here is a different example

    Total expense for September was 6 lower than prior year, driven by a lower admin expense (claims is not included because it is higher)

    Does this make sense?

    Thanks
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    03-31-2009
    Location
    Childers QLD, Australia
    MS-Off Ver
    Excel 2003, 2007 & 2013
    Posts
    128

    Re: Changing the order of text based on results

    Hi,

    I think I achieved what you may have been looking for.

    Check out your amended spreadsheet attached.

    Cheers

    TonyB
    Attached Files Attached Files

  3. #3
    Forum Contributor
    Join Date
    12-12-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    448

    Re: Changing the order of text based on results

    @TonyB51. That was helpful but not what I need. You only include "higher claims expense and admin expense" and "lower claims expense"...There are way more possibilities than that. Examples below:

    Higher...Higher claims expense (admin is lower), Higher admin expense (claims is lower) Higher claims and admin expense (both are higher, but claims is the highest), and higher admin expense and claims expense (both are higher, but admin is the highest)

    Lower...Lower claims expense (admin is higher) etc.

  4. #4
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Changing the order of text based on results

    amartin, this is the pretty much a continuation of your other thread...
    http://www.excelforum.com/excel-gene...ml#post3429497

    If you have a list of phrases, and some way to "pick" which 1 to use, when, you could probably use a vlookup inside the formula I suggested in your other post (which, by the way, you still have not commented on?)
    1. Use code tags for VBA. [code] Your Code [/code] (or use the # button)
    2. If your question is resolved, mark it SOLVED using the thread tools
    3. Click on the star if you think someone helped you

    Regards
    Ford

  5. #5
    Forum Contributor
    Join Date
    12-12-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    448

    Re: Changing the order of text based on results

    It's similar to the other thread, but the idea is much different. It has to do with order of the phrasing.

  6. #6
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Changing the order of text based on results

    Yes, I get that

    Did you read the 2nd part of my reply?

  7. #7
    Forum Contributor
    Join Date
    12-12-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    448

    Re: Changing the order of text based on results

    I did but I didn't understand it. Could you give me an example that would be applicable to the situation above?

  8. #8
    Administrator FDibbins's Avatar
    Join Date
    12-29-2011
    Location
    Duncansville, PA USA
    MS-Off Ver
    Excel 7/10/13/16/365 (PC ver 2310)
    Posts
    52,933

    Re: Changing the order of text based on results

    Total expense for September was 6 lower than prior year, driven by a lower admin expense (claims is not included because it is higher)
    I presume your "variable" text in that is "driven by...etc", and that you will have a few more like that? When will you know which 1 you want to use - what will be the criteria that will "choose" which text to insert?

  9. #9
    Forum Contributor
    Join Date
    12-12-2012
    Location
    Los Angeles
    MS-Off Ver
    Excel 2010
    Posts
    448

    Re: Changing the order of text based on results

    @F Dibbins. Incorrect. Driven by is a constant. Here are the variables (in CAPS)

    "Total expense for SEPTEMBER was 6 HIGHER/LOWER than prior year, driven by by a HIGHER/LOWER CLAIMS EXPENSE, ADMIN EXPENSE, AND DAC.

    The first part is fairly easy, I just reference a cell with the month and then based on a value in a cell, I do an if statement for value in cell and Higher/Lower based on that cell value. The second part is REALLY hard. If the first part was "higher", I want only the variables with positive values in the adjacent cell AND I want them to be in order from highest to lowest. If the first part was "lower", I want only the variables with negative values in the adjacent cell AND I want them to be in order from most negative to least negative.

    Example:
    Main variable: 10
    Claims: 4
    Admin: 10
    DAC: -4

    Sentence: Total expense for September was 10 higher than prior year, driven by a higher admin and claims expense

+ 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. Changing Capitalization and Text Order Within a Cell
    By olives in forum Excel Formulas & Functions
    Replies: 24
    Last Post: 06-13-2013, 11:53 AM
  2. Replies: 4
    Last Post: 11-20-2012, 06:00 PM
  3. Changing Order of Text and Numbers in a Cell
    By drpaulmhine in forum Excel General
    Replies: 6
    Last Post: 06-12-2012, 07:02 PM
  4. Replies: 4
    Last Post: 05-31-2006, 11:45 AM
  5. Changing text order
    By quinner in forum Excel General
    Replies: 2
    Last Post: 02-15-2006, 04:53 PM

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