Solved using Countif Mid and IF functions together? In Excel

July 30, 2019 at 21:11:26
Specs: Windows 10
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

See More: using Countif Mid and IF functions together? In Excel

Reply ↓  Report •

#1
July 31, 2019 at 04:03:15
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


Reply ↓  Report •

#2
July 31, 2019 at 04:20:19
✔ Best Answer
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

http://www.skeptic.com/


Reply ↓  Report •

#3
July 31, 2019 at 08:20:07
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


Reply ↓  Report •
Related Solutions


Ask Question