Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default compare values in auto filter

Can anyone tell me if there is a way to compare a value in an autofiltered
list to the value displayed below it? For example:

A B C
6/28/06 4
6/29/06 1
6/29/06 0
7/1/06 5
7/2/06 1
7/7/06 3

If I filter this list for column B 2, it would display rows 1, 4, and 6. I
would like to put a function in column C that would calculate the number of
days between the current row and the filtered row below it. So, that row
would show "3" in row 1 and "6" in column 2. I think something using
SUBTOTAL might work, but I can't figure it out.

The actual list I'll be using is over 5,000 lines, and the distance between
the dates could be very large. I cannot sort the list - it has to stay in
order due to other functions.

Thanks for your help.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 2,118
Default compare values in auto filter

Perhaps something like this:

With a data list in A1:B5000
Col_A contains dates (A1 is the column heading)
Col_B contains amounts (B1 is the column heading)

C1: Elapsed
D1: Counter

C2: =INDEX($A$2:$A$5000,MATCH(D2+1,$D$2:$D$5000,0))-A2
D2: =SUBTOTAL(3,$A$1:A2)
Copy those formula down as far as needed

(Adjust range references in those formulas to suit your situation)

Now filter the list. The Elapsed column (formatted as numbers, not dates)
should display the elapsed days.

Is that something you can work with?
***********
Regards,
Ron

XL2002, WinXP


"uw805" wrote:

Can anyone tell me if there is a way to compare a value in an autofiltered
list to the value displayed below it? For example:

A B C
6/28/06 4
6/29/06 1
6/29/06 0
7/1/06 5
7/2/06 1
7/7/06 3

If I filter this list for column B 2, it would display rows 1, 4, and 6. I
would like to put a function in column C that would calculate the number of
days between the current row and the filtered row below it. So, that row
would show "3" in row 1 and "6" in column 2. I think something using
SUBTOTAL might work, but I can't figure it out.

The actual list I'll be using is over 5,000 lines, and the distance between
the dates could be very large. I cannot sort the list - it has to stay in
order due to other functions.

Thanks for your help.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default compare values in auto filter

Another play to tinker with ..
this one lays the desired results direct into col C (wo autofilter)

Assuming data in cols A and B, from row1 down

Let's assume the criteria's numeric value
for col B will be input into say, E1, viz. in E1: 2

Put in C1:
=IF(D1="","",IF(ISERROR(LARGE(D:D,COUNT($D$1:D1)+1 )),"----",INDEX(A:A,MATCH(LARGE(D:D,COUNT($D$1:D1)+1),D:D, 0))-A1))

Put in D1:
=IF(OR(A1="",B1="",$E$1=""),"",IF(B1$E$1,10^5-ROW(),""))

Select C1:D1, fill down to the last row that source data is expected

Col C will return the required results, viz: 3 in C1, 6 in C4, etc, with
"blanks" in between. As a flag/indicator, "----" will be returned in the
last row in col C where col B contains a value satisfying the criteria. So
for the sample data posted, we'd get a "----" returned in C6.

(Hide away the criteria col D if desired)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"uw805" wrote:
Can anyone tell me if there is a way to compare a value in an autofiltered
list to the value displayed below it? For example:

A B C
6/28/06 4
6/29/06 1
6/29/06 0
7/1/06 5
7/2/06 1
7/7/06 3

If I filter this list for column B 2, it would display rows 1, 4, and 6. I
would like to put a function in column C that would calculate the number of
days between the current row and the filtered row below it. So, that row
would show "3" in row 1 and "6" in column 2. I think something using
SUBTOTAL might work, but I can't figure it out.

The actual list I'll be using is over 5,000 lines, and the distance between
the dates could be very large. I cannot sort the list - it has to stay in
order due to other functions.

Thanks for your help.

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default compare values in auto filter

Thanks for the suggestions - I'll try these out and see how they work. I
appreciate the help.

"Max" wrote:

Another play to tinker with ..
this one lays the desired results direct into col C (wo autofilter)

Assuming data in cols A and B, from row1 down

Let's assume the criteria's numeric value
for col B will be input into say, E1, viz. in E1: 2

Put in C1:
=IF(D1="","",IF(ISERROR(LARGE(D:D,COUNT($D$1:D1)+1 )),"----",INDEX(A:A,MATCH(LARGE(D:D,COUNT($D$1:D1)+1),D:D, 0))-A1))

Put in D1:
=IF(OR(A1="",B1="",$E$1=""),"",IF(B1$E$1,10^5-ROW(),""))

Select C1:D1, fill down to the last row that source data is expected

Col C will return the required results, viz: 3 in C1, 6 in C4, etc, with
"blanks" in between. As a flag/indicator, "----" will be returned in the
last row in col C where col B contains a value satisfying the criteria. So
for the sample data posted, we'd get a "----" returned in C6.

(Hide away the criteria col D if desired)
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"uw805" wrote:
Can anyone tell me if there is a way to compare a value in an autofiltered
list to the value displayed below it? For example:

A B C
6/28/06 4
6/29/06 1
6/29/06 0
7/1/06 5
7/2/06 1
7/7/06 3

If I filter this list for column B 2, it would display rows 1, 4, and 6. I
would like to put a function in column C that would calculate the number of
days between the current row and the filtered row below it. So, that row
would show "3" in row 1 and "6" in column 2. I think something using
SUBTOTAL might work, but I can't figure it out.

The actual list I'll be using is over 5,000 lines, and the distance between
the dates could be very large. I cannot sort the list - it has to stay in
order due to other functions.

Thanks for your help.

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Max Max is offline
external usenet poster
 
Posts: 9,221
Default compare values in auto filter

Thanks for the feedback
Do drop us a line here later how it went for you ..
--
Max
Singapore
http://savefile.com/projects/236895
xdemechanik
---
"uw805" wrote:
Thanks for the suggestions - I'll try these out and see how they work. I
appreciate the help.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
refresh auto filter jenn Excel Worksheet Functions 5 January 2nd 07 10:42 AM
Compare to a range of values using "from/to" Lisa O. Excel Discussion (Misc queries) 7 May 23rd 06 07:00 PM
re-produce/loate auto filter list Sin Excel Worksheet Functions 2 February 1st 06 10:13 PM
Formula to compare multiple rows values based on another column? Murph Excel Worksheet Functions 4 February 21st 05 02:44 AM
Why can't my macro use Auto Filter when I told the Sheet Protecti. KC Rippstein Excel Worksheet Functions 1 October 28th 04 06:13 PM


All times are GMT +1. The time now is 05:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"