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

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.
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,223,908
Messages
6,175,306
Members
452,633
Latest member
DougMo

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