+ Reply to Thread
Results 1 to 5 of 5

Help with the IF function

  1. #1
    Registered User
    Join Date
    05-23-2023
    Location
    Wollongong, Australia
    MS-Off Ver
    Office 16
    Posts
    2

    Question Help with the IF function

    Hi all,

    I'm no Excel expert, so forgive me for any silly questions.

    I'm creating a spreadsheet to track information about clients/locations. Essentially, how I'd like it to work is this:
    • Select an option from a dropdown list
    • Depending on the item selected from the list, text generates in another part of the excel spreadsheet

    For example - I select 'Mary' from the dropdown list in C7, then, in G4, I have written "=IF(C7="Mary", S45&T45&U45)". S,T, and U45 have facts about Mary. They read:

    1. Mary's favourite colour is red.
    2. Mary doesn't like bees.
    3. Mary only works on weekdays.

    What I would like the output to read is similar to the above, a list-like structure. How it currently presents is;'

    Mary's favourite colour is red.Mary doesn't like bees.Mary only works on weekdays.

    Is there a way to add a line break or something similar to my IF formula?

    Also - is there a way to pull this data from another sheet or workbook?

    Thankful for any advice - I've attached my workbook as an example.
    Attached Files Attached Files

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

    Re: Help with the IF function

    Administrative Note:

    Welcome to the forum.

    Is your forum profile showing the version of Excel that you need this to work for?

    Members will tailor the solutions they offer to the version of Office (Excel, NOT Windows) that you have. Please check that your forum profile is up-to-date in this respect. If you aren't sure, in Excel go to File | Account and report what it says below the MS logo at the top of that page. If your version is for Mac, please also state this.

    The three most recent versions of Excel are Excel 2019, Excel 2021 and MS365 - if you are using MS365, please give this name along with the release number in your profile (e.g. MS365 Version 2211). This is in the About Excel section further down the Account page.

    Thanks.
    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.

  3. #3
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Help with the IF function

    Get rid of the merged cells, rearrange the raw data a little and (assuming that you have textjoin), use:

    =TEXTJOIN(CHAR(10),,VLOOKUP(C7,$J$30:$U$33,{4,5,6,7,8,9},FALSE))
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  4. #4
    Registered User
    Join Date
    05-23-2023
    Location
    Wollongong, Australia
    MS-Off Ver
    Office 16
    Posts
    2

    Re: Help with the IF function

    Thanks for that Glenn.

    The example workbook you've given works really well.

    I was wondering if you could explain how some of it works, though. For example, what does the "{4,5,6,7,8,9}" refer to?

    If it's not too much trouble, could you provide a template of sorts for the code, so that I could apply or extend as needed? (As I mentioned in my post, I'm far from an expert in Excel.)

    Thanks .

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,064

    Re: Help with the IF function

    =TEXTJOIN(CHAR(10),,VLOOKUP(C7,$J$30:$U$33,{4,5,6,7,8,9},FALSE))

    Red Lookup the value in C7,
    Orange return an EXACT match
    Cyan looking in this column range
    Blue returning values from htese columns, if any,
    Purple: join them all together
    BLACK with CHAR (10) - a line feed - as the separator.

    That's it.




    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

+ 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: 1
    Last Post: 02-10-2023, 10:18 AM
  2. [SOLVED] Left function, Right Function, or Mid Function to extract values to three decimal places
    By bjnockle in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-08-2023, 03:22 AM
  3. Right function, Left function, Mid function to extract values in column A
    By bjnockle in forum Excel Formulas & Functions
    Replies: 18
    Last Post: 06-14-2020, 03:14 PM
  4. COUNTUNIQUE Function in Google Sheets; Excel lacks a direct counterpart to this function?
    By PivotTablePSHomage in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 03-18-2018, 05:27 AM
  5. Calling function inside function. (aka nested function)
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-02-2015, 05:58 AM
  6. Replies: 13
    Last Post: 04-08-2014, 05:46 AM
  7. Replies: 1
    Last Post: 03-21-2012, 11:22 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