Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
ineedham
Helper I
Helper I

Problem extracting text using MID & FIND/SEARCH when text doesn't contain character

 

MESSAGEDESIRED RESULTFORMULA 1 RESULTFORMULA 2 RESULT
Certification #11#11
Certification #22#22
Certification #33#33
2017 Live Webinar #1a1a#1a1a
2017 Live Webinar #1b1b#1b1b
2017 Fall Party  201
Committee Nominations  Com

 

I’m working with email message data. Sometimes, there are multiple messages with the same title, distinguished by order number (#1, #2A, etc)

 

If the message contains a “#,” I’m looking to extract the 3 characters after the “#” sign in a the text string of the email message title. If the message does not contain the “#” character, I want to return a blank.

 

If I use Formula 1, it returns the blanks, but it also returns the “#” sign, which I don’t want:

 

  Formula 1 = IFERROR(MID(Emails[Message], FIND("#",Emails[Message],1,BLANK()),3),"")

 

Formula 2 strips off the “#”, but it also returns the first 3 characters of the Messages that don’t contain “#,” instead of the blanks I want:

 

  Formula 2 = IFERROR(MID(Emails[Message], FIND("#",Emails[Message],1,BLANK())+1,3),"")

 

I can't seem to find the proper order for the IFERROR statement and its associated blank.

1 ACCEPTED SOLUTION

@ineedham

 

Hi, please check the image.

 

FIND.png




Lima - Peru

View solution in original post

4 REPLIES 4
Vvelarde
Community Champion
Community Champion

@ineedham

 

Hi, try with the follow dax:

 

 

Column =
VAR FINDIT =
    FIND ( "#", Table4[MESSAGE], 1; 0 )
RETURN
    IF ( FINDIT > 0, MID ( Table4[MESSAGE], FINDIT+1, 3 ) )



Lima - Peru

That gave me the same results as Formula 1 -- the "#" is in front of the Message order numbers.

@ineedham

 

Hi, please check the image.

 

FIND.png




Lima - Peru

Apologies,

 

I missed the +1.

 

That worked!

 

Thanks.

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

November Power BI Update Carousel

Power BI Monthly Update - November 2025

Check out the November 2025 Power BI update to learn about new features.

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.