Hoping someone out there can help me with a problem I am having. I have two columns of data, as shown below...
A | B
-----------
1| X | 10
2| X | 20
3| X | 30
4| Y | 40
5| Y | 50
6| Y | 60
I apply an auto filter on column A. In another cell I want to reference the first value in column B for whatever category in column A I have filtered. So if I have filtered only for value X, I want this cell to bring back the value 10. If I have filtered only for value Y, I want this cell to bring back the value 40.
So is there a way to have a cell who's value changes dynamically when an auto filter is changed?
Many thanks for any help you can provide.
Last edited by guyute76; 12-09-2011 at 09:16 AM.
I have attached a file for further clarification of my problem. Above is a bit of a simplification, and I may be asking the wrong question here. The attached worksheet has a graph based on the data to the left. I set it up to look like a timeline of the dates provided in the data. I have applied a filter to the data so that I can choose to look at different categories ("Work Holidays" or "Birthdays" in this case) and the graph will update based on the data that is currently showing in the filter. The problem I'm running into is with the labels I've applied to the data points in the graph. When the data is filtered to show only the "Birthdays" category, the data points on the graph are correct, but the labels still show the "Work Holidays" value. How can I create this graph so the data labels update dynamically with the rest of the graph? It would also be nice if I could get the Chart Title to update based upon which category is selected in the filter, Seems like this is the same issue and if we can solve the labels issue, we can solve the title issue with the same method.
Timeline.xls
Can anyone help me?
Try this Array formula, confirmed with CTRL+SHIFT+ENTER, rather than just ENTER.
=INDEX(C2:C20,MATCH(1,SUBTOTAL(3,OFFSET(C2,ROW(C2:C20)-ROW(C2),)),0))
HTH; Haseeb
If your problem is solved, please say so clearly, and mark your thread as Solved:
Forum Rules & How to Mark a thread as SOLVED
Assuming that Column A will always be sorted in ascending order:
=INDEX(C2:C7,SUBTOTAL(5,A2:A7))
Haseeb A & Whizbang, I'm hoping you can give me a little more context to your replies. Looks like you're both doing something similar, but I'm unclear as to what data your formulas are refering to, is this in reference to the sample data in my first post, or the data I provided in the attachment file in the second post? The data ranges you each use in your formulas are confusing me.
Thank you both.
The link you posted is not working. Since forum been allowed to attach files attach your sample on the forum instead of a link. Go to,
Go Advanced >> Manage attachments, & browse your file.
HTH; Haseeb
If your problem is solved, please say so clearly, and mark your thread as Solved:
Forum Rules & How to Mark a thread as SOLVED
Deleted...Multiple post...Sorry about that
Last edited by Haseeb A; 12-06-2011 at 02:53 PM. Reason: Multiple post
HTH; Haseeb
If your problem is solved, please say so clearly, and mark your thread as Solved:
Forum Rules & How to Mark a thread as SOLVED
Retry at attachment...
My formula is in reference to your data as per your original post.
Although my formula assumes that row 1 has header information.Originally Posted by guyute76
Thanks Whizbang. Your formula works great. Now what if I wanted to create a second cell that returns the second value in each category after filtering? So in my example...
A| B | C
-----------
1| X | 10
2| X | 20
3| X | 30
4| Y | 40
5| Y | 50
6| Y | 60
... now I want to return value 20 when filtered for X and value 50 when filtered for Y.
Last edited by guyute76; 12-07-2011 at 01:57 PM.
Bump with edit to my last post. Still trying to solve this one. Can anyone help me extrapolate Whizbang's original formula to give me the second value for each subgroup as explained in the post above?
Haseeb A's answer was much more on track than my simple solution. It ensures that the first value will be returned, no matter the sort.
Here is Haseeb A's formula, modified to account for returning multiple results.
=INDEX(C2:C20,SMALL(IF(SUBTOTAL(3,OFFSET(C2,ROW(C2:C20)-ROW(C2),))=1,ROW($C$1:$C$19)),ROW(1:1)))
This is confirms with CTRL+SHIFT+ENTER
Then copy down the number of row that you desire.
OK, this is great, you guys are really on to it here. Can I ask one more favor, and sorry to be a pain, but this formula is way over my head. Instead of saying "copy down the number of row that you desire", can you spell out exactly what this formula would look like if I wanted to return the second data value from each category? I think if I saw that, it would help me understand the formula better.
I can't thank you all enough, great forum here.
HTH; Haseeb
If your problem is solved, please say so clearly, and mark your thread as Solved:
Forum Rules & How to Mark a thread as SOLVED
A small correction on the formula:
=INDEX($C$2:$C$20,SMALL(IF(SUBTOTAL(3,OFFSET(C2,ROW($C$2:$C$20)-ROW(C2),))=1,ROW($C$1:$C$19)),ROW(1:1)))
Copied down one cell, it would be:
=INDEX($C$2:$C$20,SMALL(IF(SUBTOTAL(3,OFFSET(C3,ROW($C$2:$C$20)-ROW(C3),))=1,ROW($C$1:$C$19)),ROW(2:2)))
But you don't need to manually adjust the formula. Simply select the first cell and Copy it. Then select the desired number of cells below and then Paste. The formula will automatically adjust. That is the beauty of cell referencing. It can be fixed using the $ symbol, or relative by omiting the $. Do a Google search on cell referencing and read up on Relative, Fixed and Mixed references.
You can also take advantage of the AutoFill function. Do a search on that for more information.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks