Multiple Corresponding Values

Cyber_Cyrus

New Member
Joined
Jun 11, 2021
Messages
4
Office Version
  1. 365
Platform
  1. Windows
Good Day All,

The motivation behind the post is to find out if there is perhaps a more efficient way I can query Excel to find multiple results for a single reference.

Please refer to the below example:

1636121665178.png

As you can see from the above screenshot, I am working with 4 columns. The first (M), is the reference of a particular Sales Order. The left function was used to show only the Sales Order reference and not the transaction attempt (SO12345X1, SO12345X2, etc) The Second (N), is the number of times this reference comes forth in the list. Third (O), is the total transaction attempt for that specific reference, and the fourth(P), is my attempt to solve my own question.

If we use the highlighted record as reference (SO722299), we can see that it appears a total of 3 times within the list. Additionally, the other two times it appears, it has values of 1 transaction each. Through this I can calculate that a total of 9 transactions were made for that specific order.

I applied VBA to calculate the values within column P.

Function CusVlookup(lookupval, lookuprange As Range, indexcol As Long)
'updateby Extendoffice
Dim x As Range
Dim result As String
result = ""
For Each x In lookuprange
If x = lookupval Then
result = result & " " & x.Offset(0, indexcol - 1)
End If
Next x
CusVlookup = result
End Function

The only problem is that I work with thousands of records and I would assume it would take hours before it returns a result for each record. So that brings me back to my question. Is there a more efficient way to get the data I need (Total transaction per Order)?
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
You could use textjoin, like
Excel Formula:
=TEXTJOIN(" ",,IF(M2:M100=M2,O2:O100,""))
 
Upvote 0
Solution
You're welcome & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,223,239
Messages
6,170,947
Members
452,368
Latest member
jayp2104

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