1

I am looking to find an excel formula or VB formula which would be able to extract specific data in excel.

For example we have the following in a cell: Time spent in script:333

The above will always remain the same, however the time will be different and can range from 1 to 999 so 3 numeric characters max. However.. In some cells there maybe changes after the 3 characters and may come out like so: Time spent in script:333Q1

So I need a formula which extracts 3 numeric characters after the semi colon but to ignore anything after the 3 characters.

1
  • 1
    You say semi colon which is ; I see : a colon Commented Jun 7, 2017 at 15:28

2 Answers 2

2

Quite lengthy, but should help you,

=IF(ISNUMBER(VALUE(LEFT(MID(A1,FIND(":",A1)+1,99),3))),VALUE(LEFT(MID(A1,FIND(":",A1)+1,99),3)),IF(ISNUMBER(VALUE(LEFT(MID(A1,FIND(":",A1)+1,99),2))),VALUE(LEFT(MID(A1,FIND(":",A1)+1,99),2)),VALUE(LEFT(MID(A1,FIND(":",A1)+1,99),1))))

enter image description here

enter image description here

Sign up to request clarification or add additional context in comments.

2 Comments

This works, however when I have: Time Spent in script:502Q1 it only brings back 50. However I need to pull through a maximum 3 values
@SQLeon does your values actually have a space between the : and the first number?
-1

A1 being the cell you're referencing...

=MID(A1,22,3)

EDIT: Now works for digits 1-999

=IF(LEN(A1) = 26, MID(A1,22,3), IF(LEN(A1) = 25, MID(A1,22,2), IF(LEN(A1) = 24, MID(A1,22,1), "NA")))

3 Comments

Does the number start always at position 22?
According to OP it does. But I forgot to account for the number being 1-3 digits long - will have to fix.
Eh, I misread the initial question... It looks like Gowtham has provided a viable solution for you :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.