How to automatically identify cell-based array delimiter?

Rnkhch

Well-known Member
Joined
Apr 28, 2018
Messages
528
Office Version
  1. 365
Platform
  1. Windows
Hello,

Suppose there are cells that store a few numbers/texts as below:

Book1
ABC
1
282,78,53,A-,37,B
3C+;67;45;12;A;92
467,13;33,F,83
5
Sheet2


How can I automatically figure out what the delimiter is for each cell? And if there is more than one delimiter, get an error message?

Thanks for any input! 🤗

P.S. I need this to simplify a cool LAMBDA that I'm working on which I will post later in LAMBDA Functions :cool:
 
Sure, thank you! Please take your time. TTYS
 
Upvote 0

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
New suggestion with example of failure of the previous formula.

Rnkhch.xlsm
BIJ
1NewPost #7
282,78,53,A,37,B,,
3C+;67;45;12;A;92fix delimsfix delims
467,13;33,F,83fix delimsfix delims
568/55/704/8//
65698548;45;55;#N/A
Sheet1
Cell Formulas
RangeFormula
I2:I6I2=LET(delims,",;-+/",fnd,FIND(MID(delims,SEQUENCE(LEN(delims)),1),B2),IF(COUNT(fnd)=1,MID(delims,MATCH(9^9,fnd),1),"fix delims"))
J2:J6J2=LET(delims,",;-+/",L,LEN(delims),fnd,FIND(MID(delims,SEQUENCE(L),1),B2),IF(COUNT(fnd)=1,MID(delims,MATCH(L,fnd),1),"fix delims"))


how does the MATCH function work?
For cell I6 above the equivalent formula evaluation part is
MATCH(387420489,{#VALUE!;8;#VALUE!;#VALUE!;#VALUE})
The first #VALUE is because the first delimiter character (comma) is not found.
The 8 is where the second delimiter (semicolon) is first found. The actual number (8) is irrelevant but it indicates the semicolon was found
The other 3 #VALUE! items are because the 3rd, 4th & 5th delimiters (-+/) were not found.

This MATCH part of the formula only gets evaluated if there is a single delimiter so there will always be exactly 1 number and the rest #VALUE! errors. When MATCH cannot find the big number (9^9) it is looking for, it matches the one (smaller) number that it can find. That match is in the 2nd position of that array so it means that the delimiter in question is the second character in the 'delims' string
 
Upvote 0
Awesome! Thanks much for the function and the explanation 🤗 I'm gonna incorporate this in my LAMBDA and see how it goes. I'll update.
 
Upvote 0

Forum statistics

Threads
1,215,327
Messages
6,124,287
Members
449,149
Latest member
mwdbActuary

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