I have a section of numbers that i want to show certain information if a condition is met, the numbers vary IE here is a code ,10905806151907182411210 I want it to show this section 905806 if the part "241" is in the long list of numbers, Count if, Mid and If functions seem to be my best bet ie =IF(COUNTIF(B:B, "*241*), (MID(B:B,4,6)), (0)), where all the information is shown in column B

If the 241 exists, will it always be in the position as shown in your example? BTW, you are using too many parentheses. You don't need them around the MID function or the 0.

How To Post Data or Code ---> Click Here Before Posting Data or VBA Code

Will the section 905806 always be in the same position as shown? This seems to work.

Put this formula in C1 and drag down as many rows as needed:=IF(ISNUMBER(--MID(B1,SEARCH("241",B1),3)),MID(B1,3,6),0)

MIKE

As far as I can tell, the comma is part of your string, correct? That's the only way that 905806 begins in position 4 of the MID function that you posted: MID(B:B,4,6)

How To Post Data or Code ---> Click Here Before Posting Data or VBA Code

Ask Your Question

Weekly Poll

Do you think Big Tech does enough to help make computing secure?

Discuss in The Lounge

Poll History