PDA

View Full Version : Solved: Help with Code



jo15765
11-01-2011, 10:10 AM
I am trying to get code to display text on one line and a percent on the line below it...The code that I have this far will allow combining a text and percent field, but I want them to display like this:

Test
25%

This code:

=B19&TEXT(D19," #%")

Places them side by side, how can I add a line break or carraige return or whatever to make the percent go under the text?

Kenneth Hobs
11-01-2011, 01:16 PM
Of course you need the cell format Wrap Text set.
=B19&CHAR(10)&TEXT(D19," #%")

jo15765
11-01-2011, 01:44 PM
Kenneth that code adds the pipe character between my text and my percentage, not an actual return. Is that formatting that I need to change?

Kenneth Hobs
11-01-2011, 01:50 PM
I should have added a box character if you did not set the Wrap Text format as I explained.

jo15765
11-01-2011, 01:54 PM
Good Gravy, once I added the wrap text it worked just as you said it would. Thank you for your help!!!

jo15765
11-01-2011, 01:58 PM
Actually let me ask this since this was the purpose for me wanting this information...I have pie charts based off of Access Queries. Well when the percentage on the query updates the pie chart doesn't always update. So what I was going to do for a "Band-Aid" was to input the formula above as the pie chart tag so that when the percentage in the query updates, so will the percentage on the chart.

Does that sound feasible, or am I way out in left field on that one?

Kenneth Hobs
11-01-2011, 02:24 PM
You can ask that in another thread.

It could be something simple. I would suggest that you make a simple access file and an excel file with the chart. I know that that can take a bit of effort but it helps us help you more quickly and accurately. Sounds like you just need to update the chart series.

jo15765
11-02-2011, 05:19 AM
One more question pertaining to this code:

=B19&CHAR(10)&TEXT(D19," #%")

If it is showing 0% when I input that code it is just showing a % sign, what needs to be added in order to force it to show 0 if null?

Kenneth Hobs
11-02-2011, 03:59 PM
=If(D10="",B19&CHAR(10)& "0%",B19&CHAR(10)&TEXT(D19," #%"))