Avoid counting blank values when apply Access formula on text data type

Hi

I use below formula in Access query column, when I copy this column data set and paste in excel, then look at the count value, it shows full count of cells in the column including blank cells. How can I modify this formula which keeps only non blank values as it should be and keep blank values as blank.


EvNum1: IIf(Left(Trim([EveNum]),2)="KK",[EveNum],"")

Hope you get my point.

Cheers
Asatoma SadgamayaAnalystAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Dale FyeOwner, Developing Solutions LLCCommented:
You are trying to do this in Excel or Access?

In Access I generally use something like:

EvNum1: IIF(Left(Trim([EveNum] & ""), 2) = "KK", 1, 0)

Then you can simply sum that value (either in Excel or in Access).
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Asatoma SadgamayaAnalystAuthor Commented:
Thanks for your suggestion Dale,

what is that & "" in the formula does?

Cheers
0
Mark EdwardsChief Technology OfficerCommented:
TRIM() function blows up if you try to trim a Null.  The & "" both forces the value in the field to implicitly convert to a string AND converts a null to an empty string.  You aren't the first one to have problems of this sort trying to get counts.

Dale's technique is one I highly encourage you to understand and get use to using - much more accurate.
0
Asatoma SadgamayaAnalystAuthor Commented:
Thanks Dale
0
Dale FyeOwner, Developing Solutions LLCCommented:
happy to help.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.