asked on # How do you put =LEFT() inside =COUNTIF() in Excel?

Hello,

How do you correctly put a =LEFT() function inside of a =COUNTIF() function?

For example, here's a formula I just tried (which obviously does not work):

=COUNTIF(LEFT(L4:L33963,2),L2)

My objective is to determine how many of the entries in the range begin with the two characters: "##" (i.e. not variables but two number signs) and have the result display in L3. Therefore, I entered "##" in L2 and the above formula in L3.

In other words, I don't want to count the cells whose complete entries are the same as L3 but only those whose first two characters are the same. To do that, it seems like there should be an equal sign in there somewhere saying, "if the first two characters in a given row*equal* the value in L2 then count that row" but I can't determine where it would go.

Sometimes these formulas just fall right into place and other times it seems as though there is a 12 inch block wall (full of grout) standing in the way! :p

Thanks

How do you correctly put a =LEFT() function inside of a =COUNTIF() function?

For example, here's a formula I just tried (which obviously does not work):

=COUNTIF(LEFT(L4:L33963,2)

My objective is to determine how many of the entries in the range begin with the two characters: "##" (i.e. not variables but two number signs) and have the result display in L3. Therefore, I entered "##" in L2 and the above formula in L3.

In other words, I don't want to count the cells whose complete entries are the same as L3 but only those whose first two characters are the same. To do that, it seems like there should be an equal sign in there somewhere saying, "if the first two characters in a given row

Sometimes these formulas just fall right into place and other times it seems as though there is a 12 inch block wall (full of grout) standing in the way! :p

Thanks

Microsoft Excel

Log in or sign up to see answer

Become an EE member today7-DAY FREE TRIAL

Members can start a 7-Day Free trial then enjoy unlimited access to the platform

or

Learn why we charge membership fees

We get it - no one likes a content blocker. Take one extra minute and find out why we block content.

Not exactly the question you had in mind?

Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.

ask a questionLog in or sign up to see answer

Become an EE member today7-DAY FREE TRIAL

Members can start a 7-Day Free trial then enjoy unlimited access to the platform

or

Learn why we charge membership fees

We get it - no one likes a content blocker. Take one extra minute and find out why we block content.

Not exactly the question you had in mind?

Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.

ask a questionGet an unlimited membership to EE for less than $4 a week.

Unlimited question asking, solutions, articles and more.

You could also convert it to an array formula by confirming entry with Shift + Ctrl + Enter.

There are numerous trains of thought about array formulas, probably worth avoiding where there is another option.

Thanks

Rob H

There are numerous trains of thought about array formulas, probably worth avoiding where there is another option.

Thanks

Rob H

Multiple helpful responses! Thanks

**>>Thanks to barryhoudini for some great information....Very cool.**

Not meant to embarrass him but FYI, Barry's answers are*always* accurate, *always* straightforward, *always* easy to follow and understand, and *always* include "great information." He is a good one to follow around!

Afterthought: perhaps "always" is a tad bit too strong -- I know Barry would say so -- so perhaps we should change them to "almost always" but if we do, note that the "tad" is a very small one indeed! :)

Not meant to embarrass him but FYI, Barry's answers are

Afterthought: perhaps "always" is a tad bit too strong -- I know Barry would say so -- so perhaps we should change them to "almost always" but if we do, note that the "tad" is a very small one indeed! :)

This is the best money I have ever spent. I cannot not tell you how many times these folks have saved my bacon. I learn so much from the contributors.

rwheeler23

Thanks

Thanks to barryhoudini for some great information. I never knew why certain things didn't work, I always just found work arounds. Very cool.