Expression output based on duplicates

hermansoa

New Member
Joined
May 3, 2024
Messages
1
Office Version
  1. 365
Platform
  1. Windows
Using excel, I am automating the creation of an expression based on values from a table. My table can have duplicates and I want to find the duplicates, use only the first instance of the duplicate, then use that to search and return multiple values from another column that match. This will be used to create an output string. Unfortunately, I have no idea how to accomplish my scenarios below. I have tried indexes, lookups, matches, filters, choosecols, etc, but not sure how to fit it all together to achieve my end result. Unfortunately I can’t use Macro’s because this sheet will be given to people whose security policy won’t let macro enabled spreadsheets to be used. Any help is greatly appreciated.

EXAMPLE:

Row NumberDI Transaction TypeWhere description ContainsWhere description does not containTransaction Code
1​
ATM_WITHDRAWALWithdrawal at ATM BP
227​
2​
POS_PURCHASEDBT CRD
229​
3​
POS_PURCHASEB/P
229​
4​
ELECTRONIC_TRANSFER_CREDITZelle
56​
5​
ELECTRONIC_TRANSFER_DEBITZelle
56​
6​
POS_PURCHASEPOS DEB
228​
7​
POS_PURCHASEIBT DEB
228​


Scenarios:

  • Column B and E match, then I want to return the values in Column C (multiple).
  • Column E and C match, then I want to return the values in Column B (multiple).
I will reference the separators “&,!,||,? And others from cells in the spreadsheet

Output would look like this in a String:

Row NumberOutput String
1ATM_WITHDRAWAL && !withdrawal at ATM BP?227
2POS_PURHCASE && DBT CRD||B/P?229
4ELECTRONIC_TRANSFER_CREDIT || ELECTRONIC_TRANSFER_DEBIT && Zelle?56
6POS_PURCHASE && POS DEB||IBT DEB?228

TranCodeExpressionCreation.xlsx
ABCDEFGHIJKLM
1Row NumberDI Transaction TypeWhere description ContainsWhere description does not containTransaction Code
21ATM_WITHDRAWALWithdrawal at ATM BP227
32POS_PURCHASEDBT CRD229
43POS_PURCHASEB/P229
54ELECTRONIC_TRANSFER_CREDITZelle56
65ELECTRONIC_TRANSFER_DEBITZelle56
76POS_PURCHASEPOS DEB228
87POS_PURCHASEIBT DEB228
9
10#transactions.get(0)['transactionType']=='ATM_WITHDRAWAL' && !#transactions.get(0)['displayDescription'].contains('Withdrawal at ATM BP')?'227':(#transactions.get(0)['transactionType']=='POS_PURCHASE' && (#transactions.get(0)['displayDescription'].contains('DBT CRD')||#transactions.get(0)['displayDescription'].contains('B/P'))?'229':((#transactions.get(0)['transactionType']=='ELECTRONIC_TRANSFER_CREDIT' || #transactions.get(0)['transactionType']=='ELECTRONIC_TRANSFER_DEBIT') && #transactions.get(0)['displayDescription'].contains('ZELLE')?'56':(#transactions.get(0)['transactionType']=='POS_PURCHASE' && (#transactions.get(0)['displayDescription'].contains('POS DEB')||#transactions.get(0)['displayDescription'].contains('IBT DEB'))?'228':(''))))
11
12SeparatorsContainsDoes not contain
13#transactions.get(0)['transactionType']==''&&#transactions.get(0)['displayDescription'].contains('!#transactions.get(0)['displayDescription'].contains('')?':(||'')
14
15
16Output Example:
171#transactions.get(0)['transactionType']=='ATM_WITHDRAWAL'&&!#transactions.get(0)['displayDescription'].contains('Withdrawal at ATM BP')?'227'
182#transactions.get(0)['transactionType']=='POS_PURCHASE'&&#transactions.get(0)['displayDescription'].contains('DBT CRD')||#transactions.get(0)['displayDescription'].contains('B/P')?'229'
194#transactions.get(0)['transactionType']=='ELECTRONIC_TRANSFER_CREDIT'||#transactions.get(0)['transactionType']=='ELECTRONIC_TRANSFER_DEBIT'&&#transactions.get(0)['displayDescription'].contains('Zelle')?'56'
206#transactions.get(0)['transactionType']=='POS_PURCHASE'&&#transactions.get(0)['displayDescription'].contains('POS DEB')||#transactions.get(0)['displayDescription'].contains('IBT DEB')?'228'
Sheet1
Cell Formulas
RangeFormula
B17B17=B13&B2&C13&D13&F13&D2&G13&H13&I13&E2&I13
B18B18=B13&B3&C13&D13&E13&C3&G13&K13&E13&C4&G13&H13&I13&E3&I13
B19B19=B13&B5&C13&K13&B13&B6&C13&D13&E13&C5&G13&H13&I13&E5&I13
B20B20=B13&B7&C13&D13&E13&C7&G13&K13&E13&C8&G13&H13&I13&E7&I13
Cells with Conditional Formatting
CellConditionCell FormatStop If True
B6:B8Cell Value=""textNO
B3:B6Cell Value=""textNO
B2,B7:B8Cell Value=""textNO
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,223,880
Messages
6,175,157
Members
452,615
Latest member
bogeys2birdies

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