How to get a chart to ignore blank cells in data?

leojez

Board Regular
Joined
Apr 12, 2022
Messages
51
Office Version
  1. 365
Platform
  1. Windows
Hello,

I have a chart which includes blank cells for the series data of the line. I'd like the chart to ignore the blanks completely - as you can see, it currently pots those blank cells at zero:

1656415090852.png


The formula I have in the blank cells is

Code:
=IF(L17<>"",IFERROR(N17/J17,"0%"),"")

I'd like the chart only to plot data that is not blank. Any ideas please?

Thank you!
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college
The formula I have in the blank cells is

Code:
=IF(L17<>"",IFERROR(N17/J17,"0%"),"")
Try this formula instead

Excel Formula:
=IF(L17<>"",IFERROR(N17/J17,"0%"),NA())
 
Upvote 0
Hi, thanks so much for helping! I've applied your formula and this is what I get:

1656416000905.png


The line has been removed but the chart doesn't resize to only show the data - there's a large blank. The X axis is dates, so the #N/A cells are still registering those dates. Additionally, I'd like the cells to show blanks instead of #N/A. Possible?
 
Upvote 0
This is a topic i am interested in, i just tried the NA() trick and i can tell you it does not work. it did what you just posted as i was typing. I think the issue is that what your wanting your graph to do is have the range of data be dynamic.

I have a graph where i am counting occurences of types of things in a parato graph, and half the categories are zero but I am aware over time that could change with time. I think ultimately we might be resigned to either leaving it as is with zero values OR having to tailor the data selection each time you want to show it.

But i have hope theres a solution out there!
 
Upvote 0
@Kemidan2014
Please start your own thread rather than hijack a currently active one. You can put a link in your thread to this one if you think it relevant.

The line has been removed
.. which is all that you actually asked for. ;)
I'd like the chart only to plot data that is not blank.


To offer further suggestions, it would be good to have some small sample data to work with as we can do nothing with a picture and have no idea what columns and rows the data shown is in and therefore are guessing what the formulas are referring to. See the XL2BB link in my signature block below.
 
Upvote 0
Hi, thanks for your help so far. Below (hopefully, if I've done it correctly) is the mini sheet. Unfortunately, it doesn't seem to include the charts, so I'll attach as screenshot as well. As you can see, the ACCOUNT #2 chart includes all the dates from the beginning of the table. However, I'd like the Account #2 chart to start plotting from the first ROI number - in this example 08 Jul 2022. Is there a way to do this?

Thank you!


Portfolio Balance Tool sample data.xlsm
ABCDEFGHIJKLMNOPXYZAAABAC
1
2ACCOUNT #1ACCOUNT #2TOTALS
3
4
5
6 END OF WEEK UNREALIZED POSITIONS END OF WEEK UNREALIZED POSITIONS TOTAL UNREALIZED POSITIONS
7Week endingCapitalClose ($)CloseWkly profitCum profitROIColumn2Capital2Close ($)2Close2Wkly profit2Cum profit2ROI2Column3CAPITAL7POSITION7CUM PROFIT7ROI7Column1Week ending2
822 Jul 202230,000 €$30,00036,000 €1,000 €6,000 €20%30,000 €$30,00036,000 €0 €6,000 €20%60,000 €72,000 €12,000 €20%22 Jul 2022
915 Jul 202230,000 €$30,00035,000 €3,000 €5,000 €17%30,000 €$30,00036,000 €0 €6,000 €20%60,000 €71,000 €11,000 €18%15 Jul 2022
1008 Jul 202230,000 €$30,00032,000 €-1,500 €2,000 €7%30,000 €$30,00036,000 €36,000 €6,000 €20%60,000 €68,000 €8,000 €13%08 Jul 2022
1101 Jul 202230,000 €$30,00033,500 €0 €3,500 €12%   30,000 €33,500 €3,500 €12%01 Jul 2022
1224 Jun 202230,000 €$30,00033,500 €0 €3,500 €12%   30,000 €33,500 €3,500 €12%24 Jun 2022
1317 Jun 202230,000 €$30,00033,500 €200 €3,500 €12%   30,000 €33,500 €3,500 €12%17 Jun 2022
1410 Jun 202230,000 €$30,00033,300 €100 €3,300 €11%   30,000 €33,300 €3,300 €11%10 Jun 2022
1503 Jun 202230,000 €$22,00033,200 €200 €3,200 €11%   30,000 €33,200 €3,200 €11%03 Jun 2022
1627 May 202230,000 €$22,00033,000 €500 €3,000 €10%   30,000 €33,000 €3,000 €10%27 May 2022
1720 May 202230,000 €$20,36532,500 €700 €2,500 €8%   30,000 €32,500 €2,500 €8%20 May 2022
1813 May 202230,000 €$20,42531,800 €300 €1,800 €6%   30,000 €31,800 €1,800 €6%13 May 2022
1906 May 202230,000 €$20,87431,500 €500 €1,500 €5%   30,000 €31,500 €1,500 €5%06 May 2022
2029 Apr 202230,000 €$20,94731,000 €1,000 €1,000 €3%   30,000 €31,000 €1,000 €3%29 Apr 2022
2122 Apr 202230,000 €$34,95730,000 €30,000 €0 €0%   30,000 €30,000 €0 €0%22 Apr 2022
22
WEEKLY POSITION
Cell Formulas
RangeFormula
F8:F21,M8:M21F8=IF(E8<>"",(E8-E9),"")
G8:G21,N8:N21G8=IF(E8<>"",(E8-C8),"")
H8:H21,O8:O21H8=IF(E8<>"",IFERROR(G8/C8,"0%"),"")
X8:X21X8=C8+J8
Y8:Y21Y8=E8+L8
Z8:Z21Z8=Y8-X8
AA8:AA21AA8=IFERROR(Z8/X8,"0%")
C9:C12C9=C10
B8:B20B8=IFERROR((B9+7),"")
AC8:AC21AC8=B8


1656599868579.png
 
Upvote 0
Try changing the column O formula as shown below.

I have used Conditional Formatting to hide the #N/A error values - by making the font the same colour as the background.

leojez.xlsm
JKLMNO
1
2ACCOUNT #2
3
4
5
6 END OF WEEK UNREALIZED POSITIONS
7Capital2Close ($)2Close2Wkly profit2Cum profit2ROI2
83000030000360000600020%
93000030000360000600020%
1030000300003600036000600020%
11   
12  #N/A
13  #N/A
14  #N/A
15  #N/A
16  #N/A
17  #N/A
18  #N/A
19  #N/A
20  #N/A
21  #N/A
Sheet1
Cell Formulas
RangeFormula
M8:M21M8=IF(L8<>"",(L8-L9),"")
N8:N21N8=IF(L8<>"",(L8-J8),"")
O8:O21O8=IF(L8<>"",IFERROR(N8/J8,"0%"),IF(L7<>"","",NA()))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
O8:O21Expression=ISNA(O8)textNO


1656648769608.png
 
Upvote 0
Thanks so much Peter. Unfortunately, it doesn't work. I think the formula you gave has the wrong cell number in the 2nd part:

VBA Code:
=IF(L8<>"",IFERROR(N8/J8,"0%"),IF(L7<>"","",NA()))

Should it be:

Code:
=IF(L8<>"",IFERROR(N8/J8,"0%"),IF(L8<>"","",NA()))

Even so, after trying both, neither work - mini sheet and screen shot attached. Any further suggestions? Thank you!


Portfolio Balance Tool sample data.xlsm
ABCDEFGHIJKLMNOPXYZAAABAC
1
2ACCOUNT #1ACCOUNT #2TOTALS
3
4
5
6 END OF WEEK UNREALIZED POSITIONS END OF WEEK UNREALIZED POSITIONS TOTAL UNREALIZED POSITIONS
7Week endingCapitalClose ($)CloseWkly profitCum profitROIColumn2Capital2Close ($)2Close2Wkly profit2Cum profit2ROI2Column3CAPITAL7POSITION7CUM PROFIT7ROI7Column1Week ending2
822 Jul 202230,000 €$30,00036,000 €1,000 €6,000 €20%30,000 €$30,00036,000 €0 €6,000 €20%60,000 €72,000 €12,000 €20%22 Jul 2022
915 Jul 202230,000 €$30,00035,000 €3,000 €5,000 €17%30,000 €$30,00036,000 €0 €6,000 €20%60,000 €71,000 €11,000 €18%15 Jul 2022
1008 Jul 202230,000 €$30,00032,000 €-1,500 €2,000 €7%30,000 €$30,00036,000 €36,000 €6,000 €20%60,000 €68,000 €8,000 €13%08 Jul 2022
1101 Jul 202230,000 €$30,00033,500 €0 €3,500 €12%  #N/A30,000 €33,500 €3,500 €12%01 Jul 2022
1224 Jun 202230,000 €$30,00033,500 €0 €3,500 €12%  #N/A30,000 €33,500 €3,500 €12%24 Jun 2022
1317 Jun 202230,000 €$30,00033,500 €200 €3,500 €12%  #N/A30,000 €33,500 €3,500 €12%17 Jun 2022
1410 Jun 202230,000 €$30,00033,300 €100 €3,300 €11%  #N/A30,000 €33,300 €3,300 €11%10 Jun 2022
1503 Jun 202230,000 €$22,00033,200 €200 €3,200 €11%  #N/A30,000 €33,200 €3,200 €11%03 Jun 2022
1627 May 202230,000 €$22,00033,000 €500 €3,000 €10%  #N/A30,000 €33,000 €3,000 €10%27 May 2022
1720 May 202230,000 €$20,36532,500 €700 €2,500 €8%  #N/A30,000 €32,500 €2,500 €8%20 May 2022
1813 May 202230,000 €$20,42531,800 €300 €1,800 €6%  #N/A30,000 €31,800 €1,800 €6%13 May 2022
1906 May 202230,000 €$20,87431,500 €500 €1,500 €5%  #N/A30,000 €31,500 €1,500 €5%06 May 2022
2029 Apr 202230,000 €$20,94731,000 €1,000 €1,000 €3%  #N/A30,000 €31,000 €1,000 €3%29 Apr 2022
2122 Apr 202230,000 €$34,95730,000 €30,000 €0 €0%  #N/A30,000 €30,000 €0 €0%22 Apr 2022
22
WEEKLY POSITION
Cell Formulas
RangeFormula
F8:F21,M8:M21F8=IF(E8<>"",(E8-E9),"")
G8:G21,N8:N21G8=IF(E8<>"",(E8-C8),"")
H8:H21H8=IF(E8<>"",IFERROR(G8/C8,"0%"),"")
O8:O21O8=IF(L8<>"",IFERROR(N8/J8,"0%"),IF(L8<>"","",NA()))
X8:X21X8=C8+J8
Y8:Y21Y8=E8+L8
Z8:Z21Z8=Y8-X8
AA8:AA21AA8=IFERROR(Z8/X8,"0%")
C9:C12C9=C10
B8:B20B8=IFERROR((B9+7),"")
AC8:AC21AC8=B8


1656661051042.png
 
Upvote 0
Your requested result:

1656673024169.png


My result:

1656673068484.png



What aspect of my result is not in keeping with what you asked?
 
Upvote 0
Hi Peter, sorry if I wasn't clear. I want the chart to start at the first date when there is data. So it should look like this:

1656681147392.png
 
Upvote 0

Forum statistics

Threads
1,216,096
Messages
6,128,807
Members
449,468
Latest member
AGreen17

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top