A diffuclt formula (for me)

Welsh Mark3

Board Regular
Joined
Apr 7, 2014
Messages
164
Office Version
  1. 365
[TABLE="class: grid, width: 500"]
<tbody>[TR]
[TD]Company Name<strike></strike>
[/TD]
[TD]Group ID<strike></strike>
[/TD]
[TD]<strike></strike>PM Account No<strike></strike>
[/TD]
[TD]<strike></strike>Value<strike></strike>
[/TD]
[TD]<strike></strike>[TABLE="width: 477"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Desired Result[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[/TR]
[TR]
[TD]ELUMATEC USA INC<strike></strike>
[/TD]
[TD]<strike></strike>Group 1<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD]0

[/TD]
[TD]ELUMATEC UNITED KINGDOM LIMITED $1295 | Elumatec Benelux B.V. $300<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 251"]
<colgroup><col></colgroup><tbody>[TR]
[TD]ELUMATEC UNITED KINGDOM LIMITED[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>Group 1<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD]1295
[/TD]
[TD]ELUMATEC UNITED KINGDOM LIMITED $1295 | Elumatec Benelux B.V. $300<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 251"]
<colgroup><col></colgroup><tbody>[TR]
[TD]Elumatec Benelux B.V.[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>Group 1<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD]300
[/TD]
[TD]ELUMATEC UNITED KINGDOM LIMITED $1295 | Elumatec Benelux B.V. $300<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 251"]
<colgroup><col></colgroup><tbody>[TR]
[TD]4IMPRINT DIRECT LIMITED[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]Group 2<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD]1000
[/TD]
[TD][TABLE="width: 477"]
<colgroup><col></colgroup><tbody>[TR]
[TD]4IMPRINT DIRECT LIMITED $1000[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[/TR]
[TR]
[TD][TABLE="width: 251"]
<colgroup><col></colgroup><tbody>[TR]
[TD]4 IMPRINT INC.[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>Group 2<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD]0
[/TD]
[TD][TABLE="width: 477"]
<colgroup><col></colgroup><tbody>[TR]
[TD]4IMPRINT DIRECT LIMITED $1000[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[/TR]
[TR]
[TD]FLIGHTVIEW INC<strike></strike>
[/TD]
[TD]<strike></strike>Group 2<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[TD]0
[/TD]
[TD][TABLE="width: 477"]
<colgroup><col></colgroup><tbody>[TR]
[TD]4IMPRINT DIRECT LIMITED $1000[/TD]
[/TR]
</tbody>[/TABLE]
<strike></strike>
[/TD]
[TD]<strike></strike>
[/TD]
[/TR]
</tbody>[/TABLE]

I'm looking for a formula to be used in the desired result column. Essentially where the group numbers are the same I want to return the company name and value if the value is above zero. There will be instances where there are multiple results and some where there are just one.
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
If you have one of the newer versions of Excel (2016, 365) with the TEXTJOIN function, you can put this in E2:

=TEXTJOIN(" | ",TRUE,IF(($B$2:$B$7=B2)*($D$2:$D$7>0),$A$2:$A$7&TEXT($D$2:$D$7," $0.00"),""))

and confirm it by pressing Control+Shift+Enter. If you don't have TEXTJOIN, I'm afraid it will require VBA.
 
Upvote 0
If you have one of the newer versions of Excel (2016, 365) with the TEXTJOIN function, you can put this in E2:

=TEXTJOIN(" | ",TRUE,IF(($B$2:$B$7=B2)*($D$2:$D$7>0),$A$2:$A$7&TEXT($D$2:$D$7," $0.00"),""))

and confirm it by pressing Control+Shift+Enter. If you don't have TEXTJOIN, I'm afraid it will require VBA.


This is returning an error, I have excel 2016
 
Upvote 0
That probably means you don't have TEXTJOIN, not every version of 2016 has it. You could still use a UDF (User-Defined Function). To do that, open a copy of your workbook, right click on the sheet tab on the bottom and select View Code. Then from the VBA editor menu, select Insert > Module. On the window that opens, paste this code:

Rich (BB code):
Public Function GetList(myRange As Range, ByVal myValue As String)
Dim myData As Variant, i As Long

    myData = myRange.Value
    For i = 1 To UBound(myData)
        If myData(i, 2) = myValue And myData(i, 4) > 0 Then
            GetList = GetList & " | " & myData(i, 1) & " " & Format(myData(i, 4), "$0.00")
        End If
    Next i
    GetList = Mid(GetList, 4)
    
End Function
Now close the editor (Alt-Q, or the red X in the upper right corner). Now put this formula in E2:

=GetList($A$2:$D$7,B2)

Change the range as needed, copy down as needed. The numbers in red in the code represent columns, if you change the layout of your data, you may need to change them.
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,177
Members
453,021
Latest member
Justyna P

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top