View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Shane Devenshire[_2_] Shane Devenshire[_2_] is offline
external usenet poster
 
Posts: 3,346
Default automatic display of last 2 entries in tHe column to specified cel

A formula for A1 and B1 could be

=INDEX(C$1:C$6,MAX(ROW(C$1:C$6)*(C$1:C$6<""))+1-ROW(A1))

which will put the last entry at the top, not in the same order as the
original data.

The entry in B2 could be

=IF(AND(INDEX(D$1:D$6,MAX(ROW(D$1:D$6)*(D$1:D$6<" "))+1-ROW(B2))=INDEX(D$1:D$6,MAX(ROW(D$1:D$6)*(D$1:D$6< ""))+1-ROW(B1)),INDEX(C$1:C$6,MAX(ROW(C$1:C$6)*(C$1:C$6< ""))+1-ROW(B1))=INDEX(C$1:C$6,MAX(ROW(C$1:C$6)*(C$1:C$6< ""))+1-ROW(B2))),"",INDEX(D$1:D$6,MAX(ROW(D$1:D$6)*(D$1:D $6<""))+1-ROW(B2)))

You will need to modify it to for A2. This hides the result provided both
of the items on the last two lines match. You can not use the same formulas
on both rows nor or row 2 can you use the same formulas in column A and B.

These are array formulas and must be entered by pressing Shift+Ctrl+Enter.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"mike CBA" wrote:

what is the formula for automatically displaying the last 2 entries in
columns C and D to columns A and B. But, if the last 2 entries are the same,
only the 2nd last will be displayed. to illustrate:
1st scenario:
A B C D
5 10.50 20 10.50
10 11.00 15 11.00
5 10.50
10 11.00

2nd scenario:
A B C D
5 10.50 20 10.50
15 10.500
5 10.50
5 10.50