S
Steve
Good morning Claus and thanks again for the suggested formula and UDF.
The formula
=IFERROR(CHOOSE(LEFT(JY5540,IF(LEN(JY5540)-LEN(SUBSTITUTE(JY5540,"-",))=0,1,FIND("-",JY5540)-1)),5,3,2,1,1),0)+IFERROR(IF(LEN(JY5540)>1,CHOOSE(MID(JY5540,FIND("-",JY5540)+1,IF(LEN(JY5540)-LEN(SUBSTITUTE(JY5540,"-",))=1,1,FIND("#",SUBSTITUTE(JY5540,"-","#",2))-FIND("-",JY5540)-1)),5,3,2,1,1),0),0)
Seems to work perfectly until it comes across numbers greater than 5 .
For example, if the number was as follows:
12-12 - it returns a value of 10 having taken the first number from
each string as a 1 and counting that as a five twice. In actual fact
12-12 should return a value of zero.
Would it be possible to advise how to amend the formula to ignore any
value above 5 and any other texts values that may appear in the
string, for example PU, F, UR etc all may appear at some point in the
future.
I have updated the spreadsheet with examples of this and hope you can
help.
https://onedrive.live.com/redir?resid=CB2CB4829572A60A!316&authkey=!ACtAogKt7FPYPjY&ithint=file,xlsm
Thanks in advance
Steve
The formula
=IFERROR(CHOOSE(LEFT(JY5540,IF(LEN(JY5540)-LEN(SUBSTITUTE(JY5540,"-",))=0,1,FIND("-",JY5540)-1)),5,3,2,1,1),0)+IFERROR(IF(LEN(JY5540)>1,CHOOSE(MID(JY5540,FIND("-",JY5540)+1,IF(LEN(JY5540)-LEN(SUBSTITUTE(JY5540,"-",))=1,1,FIND("#",SUBSTITUTE(JY5540,"-","#",2))-FIND("-",JY5540)-1)),5,3,2,1,1),0),0)
Seems to work perfectly until it comes across numbers greater than 5 .
For example, if the number was as follows:
12-12 - it returns a value of 10 having taken the first number from
each string as a 1 and counting that as a five twice. In actual fact
12-12 should return a value of zero.
Would it be possible to advise how to amend the formula to ignore any
value above 5 and any other texts values that may appear in the
string, for example PU, F, UR etc all may appear at some point in the
future.
I have updated the spreadsheet with examples of this and hope you can
help.
https://onedrive.live.com/redir?resid=CB2CB4829572A60A!316&authkey=!ACtAogKt7FPYPjY&ithint=file,xlsm
Thanks in advance
Steve