+ Reply to Thread
Results 1 to 3 of 3

Generate a sentence listing words separate by commas and insert "and" for the last entry

  1. #1
    Registered User
    Join Date
    12-13-2013
    Location
    CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Exclamation Generate a sentence listing words separate by commas and insert "and" for the last entry

    Dear Excel Forum,

    I am stumped by the following problem. I hope one of you can help me.
    Goal: Create a sentence that lists items and it inserts the word "and" for the last entry.

    I have a table where the user inputs the prices. If the price is included the items and the price is included in a sentence in a different sheet.

    Apples . $5
    Oranges $1
    Pears $3
    Bananas . $2

    So for the table above, it would be: "Buy Apples $5, Oranges $1, Pears $3 and Bananas $2"

    If the table only had apples and pears, it would be "Buy Apples $5 and Pears $3"
    If the table only had pears and bananas it would be "Buy Pears $3 and Bananas #2"

    I can string the text with if statements, but I have not been able to figure out how to tell it to include the "and" for the last entry.

    Any thoughts?

  2. #2
    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,917

    Re: Generate a sentence listing words separate by commas and insert "and" for the last ent

    Hi, welcome to the forum

    Your post does not comply with Rule 8 of our Forum RULES. Do not crosspost your question on multiple forums without including links here to the other threads on other forums.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Expect cross-posted questions without a link to be closed and a message will be posted by the moderator explaining why. We are here to help so help us to help you!

    Read this to understand why we ask you to do this, and then please edit your first post to include links to any and all cross-posts in any other forums (not just this site).

    https://www.mrexcel.com/forum/excel-...ast-value.html
    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

  3. #3
    Registered User
    Join Date
    12-13-2013
    Location
    CA, USA
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Generate a sentence listing words separate by commas and insert "and" for the last ent

    Sorry about that. I understand.

+ 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. [SOLVED] Using COUNTIF for values in a table delineated by commas(",") i.e "1,2,3,4"
    By moexcelnew in forum Excel Formulas & Functions
    Replies: 9
    Last Post: 01-30-2016, 03:07 PM
  2. [SOLVED] Formula to MERGE CELLS and SEPARATE WORDS with " - "
    By Sarah1986 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 08-21-2013, 11:23 AM
  3. [SOLVED] Removing ".", "?" or "!" from last word of sentence and replacing it later in vba.
    By staggers47 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-16-2013, 07:20 AM
  4. [SOLVED] Data validation: allow entry into a cell if other three cells have "X", "Y" and "Z"?
    By RogerRangeRover in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-05-2013, 04:49 AM
  5. Adding Commas into an "Equation Sentence"
    By sighlent1 in forum Excel General
    Replies: 3
    Last Post: 05-17-2011, 04:50 PM
  6. Macro to Select "New Entry" and insert a Row
    By billykiller05 in forum Excel General
    Replies: 4
    Last Post: 05-23-2008, 12:34 PM
  7. Replies: 2
    Last Post: 01-10-2006, 12:34 PM

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