Can anyone please explain why my Mid formula is not working?
I am trying to pull the 5 digit number ID in the middle of this text string. My formula works for the ones labled CTV however for everything else it is an #Incorrect Argument. Any help would be greatly appreciated
=IFERROR(MID([Campaign Name]@row, FIND("_CTV", [Campaign Name]@row) - 5, 5), MID([Campaign Name]@row, FIND("_OLV", [Campaign Name]@row) - 5, 5, MID([Campaign Name]@row, FIND("_DISPLAY", [Campaign Name]@row) - 5, 5, MID([Campaign Name]@row, FIND("_HIS", [Campaign Name]@row) - 5, 5), MID([Campaign Name]@row, FIND("_AUDIO", [Campaign Name]@row - 5, 5)))))
Example of text strings where I need 24012, 23928, and 23836 extracted
Mazda_TTD_SO_ORLANDO-DAYTONA BCH-MELBRN_SPORT MAZDA NORTH_24012_CTV_MULTI_2023
Mazda_TTD_SO_ORLANDO-DAYTONA BCH-MELBRN_JENKINS MAZDA_23928_OLV_MULTI_2023
Mazda_TTD_SO_RALEIGH-DURHAM_SPORT DURST MAZDA_23836_DISPLAY_MULTI_2023
Best Answer
-
Hi @ConnorForm
It looks like the number is always after the 5th underscore. If this is correct then this formula should pull it for you:
=MID([Campaign Name]@row, FIND(CHAR(1), SUBSTITUTE([Campaign Name]@row, "_", CHAR(1), 5)) + 1, 5)
Hope this helps!
Answers
-
Hi @ConnorForm
It looks like the number is always after the 5th underscore. If this is correct then this formula should pull it for you:
=MID([Campaign Name]@row, FIND(CHAR(1), SUBSTITUTE([Campaign Name]@row, "_", CHAR(1), 5)) + 1, 5)
Hope this helps!
Help Article Resources
Categories
- All Categories
- 14 Welcome to the Community
- Customer Resources
- 64.9K Get Help
- 441 Global Discussions
- 140 Industry Talk
- 472 Announcements
- 4.9K Ideas & Feature Requests
- 129 Brandfolder
- 148 Just for fun
- 68 Community Job Board
- 497 Show & Tell
- 33 Member Spotlight
- 2 SmartStories
- 300 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!