extract ending 10 digits in a cell only after underscore not less or more and do not include underscore and after it characters

sapxl

New Member
Joined
Jun 20, 2020
Messages
24
Office Version
  1. 2016
  2. 2013
  3. 2011
  4. 2010
  5. 2007
Platform
  1. Windows
Dear friends,

my query is - After underscore (_) only 10 digits and not accept less than or more than 10 digits entered, it should give alert... Is there any formula combination like- IF LEN,RIGHT function to do this work.. Appreciate your help…

From the above examples, it is taking the characters _ and other characters along with the digits to complete 10 digits display… in right formula, is it possible to restrict before _(underscore) only allow 10 digits not less or more than 10 digits….

eg: meenr_product004_8403465 ---- last numbers 10 digits to be allowed to enter after the underscore if less than 10 digits then it should give me error message like ïncomplete number etc..


I'm trying with the below functions but did not get any result so far...

=RIGHT(D9,10)
=LEN(E8)
=IF(D5 = "_", RIGHT(D5,10), "NUMBER NOT VALID")
=(RIGHT(D5, FIND("_",D5)))
=LEN(RIGHT(D5, FIND("_",D5)))


Please see the screenshot in attachments...

Thanks in advance.
 

Attachments

  • 10digits after underscore no less or more.PNG
    10digits after underscore no less or more.PNG
    63.4 KB · Views: 10

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
=IF(ISNUMBER(SEARCH("_",RIGHT(D4,10))),"Incomplete Number",RIGHT(D4,10))

D4 has Values
 
Upvote 0
Hi Punit,

Thanks a ton, this code is working as expected, but it is taking after the 10 digits of underscore, it is taking further numbers entries. is it possible to restrict the number of characters to 10 digits only after the underscore... kindly check the screenshot..
 

Attachments

  • EXTRACT ONLY LAST 10 DIGITS AFTER UNDERSCORE NOT MORE.PNG
    EXTRACT ONLY LAST 10 DIGITS AFTER UNDERSCORE NOT MORE.PNG
    67 KB · Views: 2
Upvote 0
How about
+Fluff New.xlsm
DE
4123_456_123456789Check
5123_456_12345678911234567891
6123_456_12345678921Check
Main
Cell Formulas
RangeFormula
E4:E6E4=IF(LEN(TRIM(RIGHT(SUBSTITUTE(D4,"_",REPT(" ",100)),100)))<>10,"Check",RIGHT(D4,10))
 
Upvote 0
Hi Fluff,
Great!!! It is working more than expected... Thank you very much for your help.
 
Upvote 0
(y):) Fluff your solution worked... infact thanks to both (Fluff and punith)...
 
Upvote 0
Glad we could help & thanks for the feedback.
 
Upvote 0

Forum statistics

Threads
1,215,030
Messages
6,122,762
Members
449,095
Latest member
m_smith_solihull

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