Live charts in Excel: for future dates, lines drop to zero - excel

I run live market charts in Excel. A graph indicator runs from live data fed by the broker through the DDE facility in Microsoft Excel. It works fine and I am happy with it - except for one blemish I hope you can assist with.
The lines of the graph (it is a line chart type) are created in real time. The present time and the past time are great, very clean. Unfortunately in the period just ahead i.e. that hasn't arrived yet, the lines of the graph drop to zero and crawl along the x-axis into the future. This spoils the current reading of the graph.
Is there any way I can prevent this happening so that the lines (properly called curves) only exist in the past and current time period. The worksheet is set not to show zero values in formulae, but the charting facility does not appear to have this function.

If you put #N/A in the cell (using the =NA() function) the points are not drawn.
To hide the ugliness of your cells now having #N/A in them for future dates you can use a number format or conditional formatting to hide error values. You do this by adding a formula to your conditional formatting of
=ISNA(A1)
and setting the format to be a white font on a white background. Which makes the cells with #N/A in them appear blank. For versions of Excel prior to conditional formatting being available you can do the same thing with a number format but in reverse. i.e., set your font to white so all cells are invisible by default and set your number format to:
[black]0.0;[red]-0.0;[black]0.0;[black]
which should make anything that isn't an error appear with either a black or red font colour.
Regards
Dave

I once saved an Excel 97 Worksheet (with charts) in Excel 2003. After that, whenever I saved the file in '97, I got a prompt telling me that the spreadsheet was created in a newer version of Excel.
To eliminate the prompt I opened it in 2003 and saved it as an Excel 5.0/95 Workbook (*.xls). Then whenever I opened it in 97 the line charts dropped to zero at the end. They didn't do that before.
To correct the problem I right-clicked on the chart, selected Chart type, selected Custom Types, then "Colored Lines". Apparently when I saved it as Excel 5.0/95 that chart type was not supported, so the program defaulted to the type "Smooth Lines". After changing the chart type to "Colored Lines" it was only necessary to do some minor formatting.
This experience suggests a solution to the line dropping to zero problem regardless of what triggered it. Simply change the chart type. When I did that the dropped line disappeared and I didn't have to use the #N/A approach.

Related

XSSF worksheet cells having random styles

Is there any way to set style for all next cells in excel worksheet? Like for the rest of the document after certain cell?
I am using Apache POI 3.9 for exporting data to excel worksheet. Client wants colored font for invalid data. Everything is running fine, but sometimes, when I put text in empty cells in "INFORMATION" column, it makes font colored red, even after reseting cell style or explicitly asking for condition and then setting default cell style. Youre more likely to get my idea from pic of code.
Ive uploaded some pic of excel too. Hope it helps. It starts on row 37, text somehow changes color even after not running through setting conditions. I havent recognized any pattern in there.
I tried to change conditions, change cell style setting location in code... Had no effect.
Edit: It seems like the problem is not in AP but in Excel itself. It looks like the font color is changed after user input and its caused by autoformatting that is based on the context. So only option here is to change style of previous data. Could not find any other solution to this.

confluence, excel macro: spaces in imported excel file are breaking the cells in confluence created doc

I have excel file, which I successfully imported to confluence, using Excel from macro browser (just to new blank doc in confluence).
But column width, in which cells values have spaces (like "Values Have Spaces") is broken, and corresponding column looks bad (some rows instead of one in corresponding cells).
Guessing: its due to the spaces. If change with smth like "no_spaces_now" - rows became ok in excel confluence file.
How to fix this without removing spaces? (Rows in original local Excel file are looking good).
Problem is partially fixed with proposed by Jeeped checking/setting the formats. Other problem (with absence of horisontal scrolling for excel on confluence, at least in this case) raised with Atlassian.
this question will be closed as answered.
I just ran into this, myself.
Imported Excel seemed to justify any of my columns, so the spacing looked ugly, as in the OP's attached image. I did not do any formatting to default excel columns (I try to avoid formatting or anything fancy in excel as importing to confluence always results in some sort of uglifying of excel)
Anyways, the fix for me was to Center (horizontal) my excel text (which obviously looks ugly in Excel). Doing this meant my cell text in the imported table is now aligned left, rather than Justified.
If anyone has found a better solution, and can properly describe it, I would be delighted to hear. :)

Excel macro changed ActiveChart.SeriesCollection(1).XValues but the text remained unchanged

I am very new to VB or VBA, but recent work with Excel requires a huge number of repetitions. That's why I am now considering the VBA macro approach to simplify the process.
The work is simple - to generate charts with given data. But there are hundreds of charts to create, so I used copy and paste to keep the style consistency, and changed the values within afterwards.
Everything worked out pretty well with the data, but not so smooth with the axis label. I was tring to use ActiveChart.SeriesCollection(1).XValues = "=<sheet_name>!$<row_num>$<col_num>" to modify the value to some existing text in the respective cells, but it didn't work out on the chart, i.e., if the label was "total", as is in the A6 cell, in the original chart that I copied from, after selecting the pasted chart and executing the command above, the label in the new chart still says "total" instead of what's in the, say, B6 cell, which for example is "China". But when I right clicked the chart and went into "select data", the "Horizontal (Catagory) Axis Label" is indeed changed into "=sheet1!$B$6", which made me very confused.
Anyone knows how this happened and how to fix this? Is there an "update" method to the chart object or anything that I've been missing?
I am currently using Excel 2010.
Welcome to the strange world of Excel VBA.
SeriesCollection().XValues requires either a Range object or an array of points, so you must transform your string into a range:
ActiveChart.SeriesCollection(1).XValues = Sheets(<sheet_name>).Range("$<row_num>$<col_num>")

Altering Excel Font Rendering to Fit Content in Various Zoom Levels

You can easily fit the content of your cells by selecting a series of columns and double clicking with your cursor between two cells. However, if you zoom in or out the rendering of the cells changes and what had been autofit changes relative to the size of the cell and you end up with a #####.
Is there a way to autofit cells that will hold irrespective of the level of zoom?
This is probably more question for the software development team at Excel but perhaps a VBA band-aid fix could be implemented in the interim, if the problem is ever addressed.
Thanks!
Unfortunately the zoom level (by scrolling with the mousewheel) by default cannot be captured to trigger a VBA script.
The only solution seems to be to have a VBA subroutine running in the background constantly that stores the current zoomlevels and the sheet they apply to in a Public variable.
When that variable is different from the one currently observed from the application you need to activate Autofit for all the worksheet columns again.
Alternatively you could just store a single number (THE zoomlevel), then when you switch between sheets that have different zoomlevels the subroutine will immediately Autofit for the sheet you switch to.
Ofcourse you have to consider the intervals at which this is done.
Last alternative is to Autfit manually whenever you spot such occurence...
There is a menu button who does that automatically. For me it is in the Ribbon "Start", than "Rows" , than "Format" than one of the Columnwidth options.
Excuse the vague description, I am using a german version of Iffce.

Highlighting conditionally based on the date today

An Excel worksheet contains a datewise list of entries. Whenever I open the worksheet, I want today's date entry to be highlighted. For example, when I open the Excel file containing Interest payment amounts and due dates, it should tell me which Interest is due today.
Conditional Formatting is the way to go.
In Excel 2007 (not sure about earlier versions), you can conditional format against formula -- i.e. set a conditional format to equals =TODAY().
(Apologies, I had tried to upload an image for you, but I don't have enough reputation to do so...)
I'm not sure exactly what you're going for, but if you're attempting to just have the data highlighted you can use conditional formatting to cause the appropriate values to be marked out.
If you're trying to make the data actually be re-ordered or show a sub-set of the existing data onto another tab, you'll need to embed some custom visual basic code into your workbook as a macro-enabled workbook (*.xlsm). There are events inside there that can be called when the workbook is opened.

Resources