Avatar of Steve_Brady
Steve_Brady
Flag for United States of America 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
Microsoft Excel

Avatar of undefined
Last Comment
Steve_Brady

8/22/2022 - Mon
ASKER CERTIFIED SOLUTION
Patrick Matthews

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
Sign up - Free for 7 days
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 question
SOLUTION
dlmille

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
Sign up - Free for 7 days
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 question
SOLUTION
Log in to continue reading
Log In
Sign up - Free for 7 days
Get an unlimited membership to EE for less than $4 a week.
Unlimited question asking, solutions, articles and more.
SafetyFish

We were taught to split complex problems in excel into smaller parts... I've never felt like I would run out of space in a spreadsheet. Try putting the left function in another column and then referencing THAT column with your countif function. If it annoys you, you can always hide the column so you don't have to look at it. Then it will work, and it will not have the weakness of the wildcard method as explained above.

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

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
Steve_Brady

ASKER
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!  :)
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
Steve_Brady

ASKER
Thanks