+ Reply to Thread
Results 1 to 12 of 12

Formula required please

  1. #1
    Registered User
    Join Date
    02-21-2023
    Location
    Lydney
    MS-Off Ver
    2016
    Posts
    16

    Formula required please

    I have tried an If Statement, but my expertise isn't great.

    What i am trying to do on a simple table is to get the summary cell to provide the right code, if a Y is present under one of the headings, but also to add any others with a Y, as in the Example.

    If there is a N or N/A then that code is not to be shown.

    Any help would be appreciated.

    thanks.
    Attached Files Attached Files

  2. #2
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,423

    Re: Formula required please

    I'm not sure if you have the TEXTJOIN function in Excel 2016, but if so you could use this array* formula in G3:

    =TEXTJOIN(", ",TRUE,IF(Table1[@[HE]:[7EC]]="Y",C$2:F$2,""))

    *NOTE that an array formula needs to be confirmed using the key combination of Ctrl-Shift-Enter instead of the usual Enter.

    Hope this helps.

    Pete

  3. #3
    Registered User
    Join Date
    02-21-2023
    Location
    Lydney
    MS-Off Ver
    2016
    Posts
    16

    Re: Formula required please

    Thanks for the reply, however, I'm on 2016 and TextJoin is not available. So i need another option if ones available.

  4. #4
    Forum Contributor
    Join Date
    01-07-2025
    Location
    Iran
    MS-Off Ver
    Pro.Plus.2024.v2502
    Posts
    156

    Re: Formula required please

    please create TEXTJOIN function by VBA, so copy the following code:

    PHP Code: 
    Function TextJoin(delimiter As Stringignore_empty As BooleanParamArray text() As Variant) As String
        Dim i 
    As Long
        Dim result 
    As String
        
        
    For LBound(textTo UBound(text)
            If 
    ignore_empty And text(i) = "" Then
            
    Else
                
    result result text(i) & delimiter
            End 
    If
        
    Next i
        
        
    If Len(result) > 0 Then
            result 
    Left(resultLen(result) - Len(delimiter))
        
    End If
        
        
    TextJoin result
    End 
    Function 

  5. #5
    Forum Contributor
    Join Date
    01-07-2025
    Location
    Iran
    MS-Off Ver
    Pro.Plus.2024.v2502
    Posts
    156

    Re: Formula required please

    And save your file with this format *.xlsm. let me know if you have any question.

  6. #6
    Registered User
    Join Date
    02-21-2023
    Location
    Lydney
    MS-Off Ver
    2016
    Posts
    16

    Re: Formula required please

    Ah, not familiar with VBA so thats something really new to me, so not sure what to do with this or how it works.

  7. #7
    Forum Contributor
    Join Date
    01-07-2025
    Location
    Iran
    MS-Off Ver
    Pro.Plus.2024.v2502
    Posts
    156

    Re: Formula required please

    Press Alt + F11. This keyboard shortcut opens the VBA editor.
    In the VBA editor, go to Insert > Module. This will open a new module window where you can past the VBA code.
    Close the VBA editor and go back to Excel. And save your file with this format *.xlsm. Now you can use the TEXTJOIN function.
    Last edited by MiNd_HuNT3r; 01-27-2025 at 07:55 AM.

  8. #8
    Forum Expert
    Join Date
    07-23-2018
    Location
    UK
    MS-Off Ver
    O365 32bit (Windows)
    Posts
    3,046

    Re: Formula required please

    How about:
    Formula: copy to clipboard
    Please Login or Register  to view this content.

  9. #9
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,423

    Re: Formula required please

    You could use this formula instead of my earlier one:

    =SUBSTITUTE(SUBSTITUTE(IF(C3="Y",C$2&", ","")&IF(D3="Y",D$2&", ","")&IF(E3="Y",E$2&", ","")&IF(F3="Y",F$2&", ","")&"x",", x",""),"x","")

    Hope this helps.

    Pete

  10. #10
    Registered User
    Join Date
    02-21-2023
    Location
    Lydney
    MS-Off Ver
    2016
    Posts
    16

    Re: Formula required please

    Thanks for both options, the latter is the better and works. Thank you.

  11. #11
    Forum Guru Pete_UK's Avatar
    Join Date
    12-31-2011
    Location
    Warrington, England
    MS-Off Ver
    Office 2019 (still learning)
    Posts
    25,423

    Re: Formula required please

    You're welcome, and thanks for the rep.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    Pete

  12. #12
    Registered User
    Join Date
    02-21-2023
    Location
    Lydney
    MS-Off Ver
    2016
    Posts
    16
    Quote Originally Posted by Pete_UK View Post
    You're welcome, and thanks for the rep.

    If that takes care of your original question, please take a moment to select Thread Tools from the menu above and to the right of your first post in this thread, and mark the thread as SOLVED.

    Pete
    Thanks will do. Once I’m back on the pc. Can’t see how to do that on the iPhone. However thanks for your help today.

+ 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] Formula Required to calculate the Volume Required to achieve the Target % Set
    By Yadavgiri in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-01-2021, 07:25 AM
  2. Formula Required to add on Numbers as required to other data
    By choccy_77 in forum Excel Formulas & Functions
    Replies: 10
    Last Post: 02-01-2020, 01:16 PM
  3. Replies: 8
    Last Post: 06-06-2018, 09:20 AM
  4. Replies: 3
    Last Post: 01-24-2017, 08:08 AM
  5. Replies: 6
    Last Post: 01-17-2016, 09:44 AM
  6. Multiple Vlookup Normal Formula (not array formula) or VBA Function Required
    By BoopathiK in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 11-17-2015, 03:06 AM
  7. Formula required to hide results from another cell formula
    By 917 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-07-2013, 12:12 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