Formula: Duplicate Numbers

pochie2741

New Member
Joined
Dec 8, 2021
Messages
9
Office Version
  1. 2019
Platform
  1. Windows
Hello Everyone,

Need help please for a formula under Results Column:
  • If the ticket numbers are the same (with duplicates below it), results will show combination of the fruits separated by a slash. The result should only show on the first ticket number. The rest of the same ticket numbers will show as blank.
  • If the ticket number does not have duplicate tickets below it, it will show the assigned fruit.




TicketFruitResult
123AppleApple/Orange/Mango
123Orange
123Mango
456BananaBanana
789AppleApple/Banana
789Banana
321GrapesGrapes
 

Excel Facts

Select a hidden cell
Somehide hide payroll data in column G? Press F5. Type G1. Enter. Look in formula bar while you arrow down through G.
Hi & welcome to MrExcel.
How about
VBA Code:
Function pochie(Rng As Range, Crit As Range) As String
   Dim cl As Range
   
   For Each cl In Rng.Columns(1).Cells
      If cl.Value = Crit Then pochie = pochie & "/" & cl.Offset(, 1).Value
   Next cl
   pochie = Mid(pochie, 2)
End Function
used like
+Fluff 1.xlsm
ABC
1TicketFruitResult
2123AppleApple/Orange/Mango
3123Orange 
4123Mango 
5456BananaBanana
6789AppleApple/Banana
7789Banana 
8321GrapesGrapes
Data
Cell Formulas
RangeFormula
C2:C8C2=IF(COUNTIFS(A$2:A2,A2)=1,pochie(A2:B8,A2),"")
 
Upvote 0
Sorry, I'm not familiar with VBA code. Is there a way to change "pochie" into a formula?
 
Upvote 0
With your version of Xl, not really. If you had xl2019 or newer you could use the TextJoin function, but that does not exist in xl2016.
 
Upvote 0
Yes, im using 2019. How do I winsert textjoin in the formula?
=IF(COUNTIFS(A$2:A2,A2)=1,pochie(A2:B8,A2),"")
 
Upvote 0
In that case how about
+Fluff 1.xlsm
ABC
1TicketFruitResult
2123AppleApple/Orange/Mango
3123Orange 
4123Mango 
5456BananaBanana
6789AppleApple/Banana
7789Banana 
8321GrapesGrapes
Data
Cell Formulas
RangeFormula
C2:C8C2=IF(COUNTIFS(A$2:A2,A2)=1,TEXTJOIN("/",,IF($A$2:$A$8=A2,$B$2:$B$8,"")),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
 
Upvote 0
In that case how about
+Fluff 1.xlsm
ABC
1TicketFruitResult
2123AppleApple/Orange/Mango
3123Orange 
4123Mango 
5456BananaBanana
6789AppleApple/Banana
7789Banana 
8321GrapesGrapes
Data
Cell Formulas
RangeFormula
C2:C8C2=IF(COUNTIFS(A$2:A2,A2)=1,TEXTJOIN("/",,IF($A$2:$A$8=A2,$B$2:$B$8,"")),"")
Press CTRL+SHIFT+ENTER to enter array formulas.
Thank you very much! it works perfectly :)
 
Upvote 0
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,214,584
Messages
6,120,387
Members
448,957
Latest member
Hat4Life

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