ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   One-line bar chart for % (https://www.excelbanter.com/excel-programming/302049-one-line-bar-chart-%25.html)

Kilcup[_6_]

One-line bar chart for %
 
Hello all,

I have a list of percentages that I hope can be represented by a singl
horizontal bar chart. Each bar would represent the percentage in th
cell to its left.

No comparisons or multibar are needed, just a one line bar that fit
the next cell horizontally, like so:

56% Chart
78% Chart
61% Chart
and so on...

The chart will be the same size for all entries.
If anyone can help or has any pointers, some direction would be greatl
appreciated.

Jef

--
Message posted from http://www.ExcelForum.com


Earl Kiosterud[_3_]

One-line bar chart for %
 
Jeff,

You want something to the right of these cells that graphically shows
(chart-style, horizontally) the value in each cell? I don't know if I've
interpreted your question correctly. Try this:

=REPT("-",A2*100)

Copy down.
--
Earl Kiosterud
mvpearl omitthisword at verizon period net
-------------------------------------------

"Kilcup " wrote in message
...
Hello all,

I have a list of percentages that I hope can be represented by a single
horizontal bar chart. Each bar would represent the percentage in the
cell to its left.

No comparisons or multibar are needed, just a one line bar that fits
the next cell horizontally, like so:

56% Chart
78% Chart
61% Chart
and so on...

The chart will be the same size for all entries.
If anyone can help or has any pointers, some direction would be greatly
appreciated.

Jeff


---
Message posted from http://www.ExcelForum.com/




Kilcup[_7_]

One-line bar chart for %
 
Thanks for the help with this, it gets the idea across, which is what
need. I still seem to have some issues formulating the same thin
within vba, though. This is what I have thus far:


Set rng = Cells(Rows.Count, 1).End(xlUp)

Worksheets("_DeputationQuery").Range("F1").Activat e
For i = 1 To rng.Row
ActiveCell.Formula = "=REPT(""|"",E" & i & "*100)"
ActiveCell.Offset(1, 0).Select
Next i


The error I receive is from the "ActiveCell.Formula" line. If you ca
help me finish this off, a director at my office will definitel
appreciate it!

Jef

--
Message posted from http://www.ExcelForum.com


Dave Peterson[_3_]

One-line bar chart for %
 
Your code worked ok for me, but another way to do this is to populate the whole
range in one fell swoop.

Just like selecting a range, typing the formula (for the activecell) and hitting
ctrl-enter to fill the other cells in the selection.

Dim lastRow As Long
With Worksheets("_DeputationQuery")
lastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
.Range("f1:f" & lastRow).Formula = "=REPT(""|"",E1*100)"
End With



"Kilcup <" wrote:

Thanks for the help with this, it gets the idea across, which is what I
need. I still seem to have some issues formulating the same thing
within vba, though. This is what I have thus far:

Set rng = Cells(Rows.Count, 1).End(xlUp)

Worksheets("_DeputationQuery").Range("F1").Activat e
For i = 1 To rng.Row
ActiveCell.Formula = "=REPT(""|"",E" & i & "*100)"
ActiveCell.Offset(1, 0).Select
Next i

The error I receive is from the "ActiveCell.Formula" line. If you can
help me finish this off, a director at my office will definitely
appreciate it!

Jeff

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson


Kilcup[_8_]

One-line bar chart for %
 
Thank you all,

It looks like it should work fine!

Jef

--
Message posted from http://www.ExcelForum.com


Dave Peterson[_3_]

One-line bar chart for %
 
Try this manually against a cell with a percentage in it (test worksheet):

=REPT(REPT(CHAR(134),4)&" ",INT(A1*100/5))&REPT("|",MOD(A1*100,5))

If you like that effect:

In your code:

..Range("f1:f" & lastRow).Formula _
= "=REPT(REPT(CHAR(134),4)&"" "",INT(E1*100/5))&REPT(""|"",MOD(E1*100,5))"

"Kilcup <" wrote:

Thank you all,

It looks like it should work fine!

Jeff

---
Message posted from http://www.ExcelForum.com/


--

Dave Peterson



All times are GMT +1. The time now is 10:06 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com