kelsanit
asked on
Right function starting at specific character
i have the following field that varies in lenght and need to do a right function based on everything after the "-"
example of fields:
123456-knoxville
85632547-charlotte
22222-Chattanooga
want it to return:
knoxville
charlotte
Chattanooga
example of fields:
123456-knoxville
85632547-charlotte
22222-Chattanooga
want it to return:
knoxville
charlotte
Chattanooga
ASKER
here is what i entered as "myfiedld" is {@EquipmentID}
MID({@EquipmentID}, INSTR({@EquipmentID}, " ") + 1, LEN({@EquipmentID}-(INSTR( {@Equipmen tID}, " ") + 1)))
Get error " A number, currency amount, date, time or date time is required
MID({@EquipmentID}, INSTR({@EquipmentID}, " ") + 1, LEN({@EquipmentID}-(INSTR(
Get error " A number, currency amount, date, time or date time is required
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
You have the ( ) paired in the wrong places. Try that this way
MID({@EquipmentID}, INSTR({@EquipmentID}, " ") + 1, LEN({@EquipmentID}) - INSTR({@EquipmentID}, " ") + 1)
mlmcc
MID({@EquipmentID}, INSTR({@EquipmentID}, " ") + 1, LEN({@EquipmentID}) - INSTR({@EquipmentID}, " ") + 1)
mlmcc
ASKER
Tried the first fuction SPLIT and got the following error "A subscript must be between 1 and the size of the array"
Split({@EquipmentID},'-')[ 1]
Tried the other MID function and returned the full text.
MID({@EquipmentID}, INSTR({@EquipmentID}, " ") + 1, LEN({@EquipmentID}) - INSTR({@EquipmentID}, " ") + 1)
Split({@EquipmentID},'-')[
Tried the other MID function and returned the full text.
MID({@EquipmentID}, INSTR({@EquipmentID}, " ") + 1, LEN({@EquipmentID}) - INSTR({@EquipmentID}, " ") + 1)
THe INSTR needs to search for -
MID({@EquipmentID}, INSTR({@EquipmentID}, "-") + 1, LEN({@EquipmentID}) - INSTR({@EquipmentID}, "-") + 1)
the subscript error indicates some don't have a - or are NULL
What is the {@EquipmentID} formula?
mlmcc
MID({@EquipmentID}, INSTR({@EquipmentID}, "-") + 1, LEN({@EquipmentID}) - INSTR({@EquipmentID}, "-") + 1)
the subscript error indicates some don't have a - or are NULL
If InStr({@EquipmentID}, "-") > 0 then
Split({@EquipmentID},'-')[2]
Else
{@EquipmentID}
What is the {@EquipmentID} formula?
mlmcc
ASKER
if {RS_ROUTE_EQUIPMENT.EQUIPM ENT_ID}="- " then "" else {RS_ROUTE_EQUIPMENT.EQUIPM ENT_ID}
ASKER
Used the equipmentid field in the table and the split function worked. Thank you
ASKER
found one more issue.
there are sometimes two "-" in the text field how do I make sure i always get the text after the last dash?
example:
487-156-knoxville
12345-knoxville
desired output:
knoxville
knoxville
there are sometimes two "-" in the text field how do I make sure i always get the text after the last dash?
example:
487-156-knoxville
12345-knoxville
desired output:
knoxville
knoxville
Try this with the split
Split({RS_ROUTE_EQUIPMENT. EQUIPMENT_ ID},'-')[U Bound(Spli t({RS_ROUT E_EQUIPMEN T.EQUIPMEN T_ID},'-') ]
mlmcc
Split({RS_ROUTE_EQUIPMENT.
mlmcc
FWIW, another way to get everything after the last "-" would be:
Mid ({RS_ROUTE_EQUIPMENT.EQUIP MENT_ID}, InStrRev ({RS_ROUTE_EQUIPMENT.EQUIP MENT_ID}, "-") + 1)
If the field could be null, you could add a check for that.
James
Mid ({RS_ROUTE_EQUIPMENT.EQUIP
If the field could be null, you could add a check for that.
James
pls try
Open in new window
Regards