Hi everyone,
I would like to search a cell for a string "p" followed by four numbers. Eg. P0400
Any ideas?
Thanks,
Hi everyone,
I would like to search a cell for a string "p" followed by four numbers. Eg. P0400
Any ideas?
Thanks,
Attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are demonstrated, mock them up manually if needed. Remember to desensitize the data.
Click on GO ADVANCED and use the paperclip icon to open the upload window.
View Pic
If your problem is solved, then please mark the thread as SOLVED>>Above your first post>>Thread Tools>>
Mark your thread as Solved
If the suggestion helps you, then Click *below to Add Reputation
Searching can be done many ways. One way would be to use filters, then click on text filters and you can select "begins with..." or "Contains..." or some other parameter. It is difficult to give you a more detailed answer without more information or as 6th sense noted - a sample file with before and after.
If you just need a formula then a left formula would work but you don't say if the P is always on the far left side of the cell or the lengths are consistent where a P would be found.
Make contributors happy, click on the "* Add Reputation" as a way to say thank you.
Sam Capricci
Sorry. Here you go!
Thank you so much for your time and effort!
Last edited by wanjaf; 12-02-2014 at 09:16 AM.
see the attached file
Samba
Say thanks to those who have helped you by clicking Add Reputation star.
Maybe this
=IF(LEN("P"&SUBSTITUTE(TRIM(RIGHT(SUBSTITUTE(A4,"P",REPT(" ",25)),25)),".",""))=5,"Yes","No")
If you like my answer please click on * Add Reputation
Don't forget to mark threads as "Solved" if your problem has been resolved
"Nothing is so firmly believed as what we least know."
--Michel de Montaigne
Brilliant, nflsales! Thank you so much. But isn't it weird that if I replace "P0500" in cell A4 to "P1500" the function returns no Yes nor No (= error)?
Alkey, your solution works too, thank you! However when I add some characters behind the P-code (E.g. "P0111 some more text") the function returns "No".
Last edited by wanjaf; 12-02-2014 at 10:35 AM.
Dear wanjaf. You can always count on getting more accurate results if you provide more accurate complete requirements. Unfortunately, this wasn't the case.
See if this one will work better
=IF(MID(A4,LOOKUP(25^25,MIN(IFERROR(FIND({0,1,2,3,4,5,6,7,8,9},A4),""))-1),1)="P","Yes","No")
Row\Col A B 3Title Title contains P-code? 4TPA Wire-harness - wrong assembly - DTC P0500 Yes 5Front Pass Side rear airbag sensor malfunction (DTC B1630) No 6Automatic gearbox malfunction DTC:P2714. Yes 7Tire pressure monitor bulb functional [ Poor ] (C2121) No 8Automatic gearbox malfunction DTC:P2714POII Yes 9Front Pass Side rear airbag sensor malfunction (DTC :P0156POPYYY Yes
Last edited by AlKey; 12-02-2014 at 11:45 AM.
Try this formula in B2, confirm with Ctrl – Shift – Enter, not just Enter:
Please Login or Register to view this content.
Thank you, Alkey! Your formula works perfectly. Sorry I was not clear from the beginning.
Thank you as well, István Hirsch, your formula works too when I confirm with Ctrl – Shift – Enter!
Last edited by wanjaf; 12-03-2014 at 02:55 AM.
Please check. At me:
Formula in #9 says „YES” for P1 or P21 etc., not only for P1234 and says „NO” for P1234xx.
Formula in #5 says „YES” for P1234567 and says nothing for xxxP1xxxP1234 or xxx2xxxP1234
You're welcome and thank you for the feedback!
Please mark thread as "Solved" if your issue has been resolved. (Selecting Thread Tools -> Mark thread as Solved).
Please check:
Your formula in #9 does not check the number of digits following „P” so it gives false positive for any number of digits following „P”, for example for P1, P12, P123, P1234567 etc.
It gives false negative if a P1234 structure is preceded by any number, for example xx2xxP1234.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks