xcelnovice101
Active Member
- Joined
- Aug 24, 2012
- Messages
- 368
I am trying to have a cell prepopulate based on the tab name which should be one of the following options:
"DB", "HC", "DB-HC", "HC-DB", "HC&DB" or "DB&HC"
Below is my formula in excel, not VBA and everything appears to be working except for the first section highlighted in red. I think it all comes down to using "&&" in the formula. I've tried "&" and that doesn't work either.
"DB", "HC", "DB-HC", "HC-DB", "HC&DB" or "DB&HC"
Below is my formula in excel, not VBA and everything appears to be working except for the first section highlighted in red. I think it all comes down to using "&&" in the formula. I've tried "&" and that doesn't work either.
Code:
=IFERROR([COLOR=#ff0000]IF(SEARCH(OR("-","&&"),LEFT(MID(CELL("filename",M1),FIND("]",CELL("filename",M1))+1,255),5),1)>0[/COLOR],LEFT(MID(CELL("filename",M1),FIND("]",CELL("filename",M1))+1,255),5),LEFT(MID(CELL("filename",M1),FIND("]",CELL("filename",M1))+1,255),2)),LEFT(MID(CELL("filename",M1),FIND("]",CELL("filename",M1))+1,255),2))