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
- Smartsheet Customer Resources
- 63.6K Get Help
- 403 Global Discussions
- 215 Industry Talk
- 454 Announcements
- 4.7K Ideas & Feature Requests
- 141 Brandfolder
- 136 Just for fun
- 56 Community Job Board
- 459 Show & Tell
- 31 Member Spotlight
- 1 SmartStories
- 296 Events
- 36 Webinars
- 7.3K Forum Archives
Check out the Formula Handbook template!