Doorgaan naar hoofdcontent

Excel: Hidden Rows in Charts

I was struggling with a simple column graph. I was just wondering if there is a formula in Excel which can indicate whether a row is hidden or not. Without using VBA of course.

Here are my data:

Year Apples
2001 10
2002 11
2003 12
2004 13
2005 14
2006 15
2007 16
2008 17
2009 18
2010 19
2011 20
2012 21
2013 22
2014 23
2015 24

What I wanted to achieve is a graph like this which does not show the rows I hid, in this example the years 2005-2008, but where I still can see the X-axis values.


In this chart I checked the box Show data in hidden rows and columns


Otherwise I would not get the years 2005-2008 on the X-axis.

So I needed a function to check wether a row is hidden or not in order to manipulate the data in column B:B. Here is my solution.

I turned my data list into a table. Then I added a third column with this formula:

=IF(SUBTOTAL(103;[@Apples])=0;NA();[@Apples])

Without the table the formula would have looked like this:

=IF(SUBTOTAL(103;B2)=0;NA();B2)

The formula SUBTOTAL(103;[@Apples]) performs a COUNTA without the hidden rows. So in this case, it either returns a 0 or a 1, depending on whether the row is hidden or not.

After that i created simple dynamic names Apples:

=OFFSET(Blad1!$C$2;0;0;COUNTA(Blad1!$C:$C)-1;1)

and Years:

=OFFSET(Blad1!$A$2;0;0;COUNTA(Blad1!$B:$B)-1;1)

So, now I get the result I shows in my example graph. Actually it does not matter whether you hide rows by hand or by using the data filter.

You can download ExcelGrafiekSubtotaal.xlsx via:

https://drive.google.com/folderview?id=0B7HgkOwFZtdZVmhRQUZFM28yc1U&usp=sharing

Reacties

Populaire posts van deze blog

Friesland: nu ruim 1500 Friese familiewapens doorzoekbaar

Inleiding Het totale overzicht is nu ook als PDF te downloaden: rptWapens Al jaren verzamel ik de teksten van grafzerken en andere voorwerpen om ze in een database bijeen te brengen. Op heel veel oude grafzerken, rouwborden of andere voorwerpen in Friesland treffen we naast tekst ook vaak familiewapens aan. Ruim een jaar geleden ben ik gestart met het koppelen van familiewapens aan deze teksten. Met behulp van deze database kunnen we nu steeds meer voorheen onbekende wapens thuisbrengen of andersom, initialen herleiden tot de bijbehorende namen. Een voorbeeld. Zo kennen we uit het boek Fries Zilver nummer 894 met de tekst: TDH RBB 1669 Tjitte D. Wijngaarden geboren 6 october 1874 Daarbij een mannen- en een vrouwenwapen. Mannenwapen blijkt dat van Hoitinga te zijn. De letters blijken vervolgens te herleiden tot Tjepke Douwes Hoitinga en Rienkje Bouwes Bruinsma uit Nijland. Vermoedelijk getrouwd in 1669! Opgelost. Ander voorbeeld. Op een lepel uit het boek Dokk...

Excel: VBA script om wachtwoord te verwijderen

Af en toe krijg ik een vraag om een wachtwoord van een Excel blad te halen. Doodsimpel met VBA. Hier een script dat ik gebruik: Sub WachtwoordCrack()     Dim a As Integer, b As Integer, c As Integer, d As Integer, _     e As Integer, f As Integer, g As Integer, h As Integer, _  I As Integer, j As Integer, k, m As Integer     Dim begin As Date, eind As Date     Dim duur As String     Dim objSheet As Worksheet     begin = TimeValue(Time)     On Error Resume Next     For Each objSheet In Application.Worksheets         For a = 65 To 66: For b = 65 To 66: For c = 65 To 66             For d = 65 To 66: For e = 65 To 66: For f = 65 To 66                 For g = 65 To 66: For h = 65 To 66: For I = 65 To 66                     For j = 65 To 66: For k = 65 To...

Excel: Creating Your Own Tabs With XML And VBA

In order to create you own nice looking tabs you need the Custom UI Editor for Microsoft Office. You can download it for free. How is this different from choosing File , Options , Customize Ribbon and adding a new tab with new groups and then commands to the group? You can also move the new tab to any position. T hen your new tab is always there. Even when you don't open the specific file with the right VBA. In my example the outcome looks like this, a nice tab, placed in front of the Home Tab. You will only get this tab when you start the specific example (which you can download). The XML behind this: <customUI xmlns="http://schemas.microsoft.com/office/2006/01/customui">    <ribbon startFromScratch="false">     <tabs>       <tab id="MaxIlze" label="Dossier Overzicht" insertBeforeMso="TabHome">         <group id="customGroup1" label="Adressen verrijken">         ...