Dividing using DCount

gigifarrow
gigifarrow used Ask the Experts™
on
This code divides the answer by 11
 I need to divide 11 by the answer. How do I do that?
for example instead of 2 / 11
 
I need it to show 11/2

=DCount("*","tblMODHistory","[Div] = '170-HBCT'")/11 & "%"
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Wouldn't that just be =11/DCount("*","tblMODHistory","[Div] = '170-HBCT'") & "%"

Author

Commented:
That doesnt work.
mbizupNerd
Most Valuable Expert 2012
Top Expert 2013

Commented:
Does that mean you get an error, or that you get unexpected results?


Try this:
=(11/iif(DCount("*","tblMODHistory","[Div] = '170-HBCT'") =0,1, DCount("*","tblMODHistory","[Div] = '170-HBCT'"))) & "%"

Open in new window

Success in ‘20 With a Profitable Pricing Strategy

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden using our free interactive tool and use it to determine the right price for your IT services. Start calculating Now!

gigafarrow,

Try:
=( 11/DCount("*","tblMODHistory","[Div] = '170-HBCT'") ) & "%"
if you want to just stick the symbol on the end (without dividing by 100)

or

=Format(11 / DCount("*","tblMODHistory","[Div] = '170-HBCT'"), "Percent")


I think the concatenation of % was happening before the division.

pT72

Author

Commented:
Good job!

pT72
Scratch that about operator precedence. All arithmetic operators go before concatenation.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial