Help re writing a formula - INDEX

j4ymf

Well-known Member
Joined
Apr 28, 2003
Messages
755
Office Version
  1. 365
Platform
  1. Windows
=IFERROR(INDEX(Download!J:J,AGGREGATE(15,6,ROW(Download!J:J)/(COUNTIF(B$4:B4,Download!D:D)=0)/(Download!F:F=B4),1)),"")

Hello All

I was wondering if you could help me alter this code that someone wrote on here previously
My data comes from the Download sheet, the top table with the black cells is the rewuired answers, the bottom table with the 3 red cells is the ones i require the formuls to be re written if you could help please.

could you please change the formula above to find the second and third answer in the list,

mant thanks Jason

output_20210128T133123_000001jay.xls
ABCDEFGH
1
2
3
428/01/2021Joe Bloggs9999 - Test - Houseblock BDetail 12£77.00£154.00
528/01/2021Joe Bloggs9999 - Test - Houseblock BDetail 2A (First Visit)30£88.00£2,640.00
628/01/2021Joe Bloggs9999 - Test - Houseblock BDetail 36£99.00£594.00
729/01/2021Joe Bloggs9999 - Test - Houseblock C 1£33.00£33.00
839£3,388.00
9
1028/01/2021Joe Bloggs9999 - Test - Houseblock BDetail 12£77.00£154.00
1128/01/2021Joe Bloggs9999 - Test - Houseblock B 30£88.00£2,640.00
1228/01/2021Joe Bloggs9999 - Test - Houseblock B 6£99.00£594.00
1329/01/2021Joe BloggsDetail 41£33.00£33.00
1439£3,388.00
15
16First in the list
17First in the list
18second in the list
19Second in the list
20
21Third in the lists
22
Sheet2
Cell Formulas
RangeFormula
D4,D10D4=IFERROR(INDEX(Download!J:J,AGGREGATE(15,6,ROW(Download!J:J)/(COUNTIF(B$4:B4,Download!D:D)=0)/(Download!F:F=B4),1)),"")
C4,C10C4=IFERROR(INDEX(Download!D:D,AGGREGATE(15,6,ROW(Download!D:D)/(COUNTIF(B$4:B4,Download!D:D)=0)/(Download!F:F=B4),2)),"")
C5:C6,C11:C12C5=IFERROR(INDEX(Download!D:D,AGGREGATE(15,6,ROW(Download!D:D)/(COUNTIF(B$3:B5,Download!D:D)=0)/(Download!F:F=B5),2)),"")
D7D7=IFERROR(INDEX(Download!J:J,AGGREGATE(15,6,ROW(Download!J:J)/(COUNTIF(#REF!,Download!D:D)=0)/(Download!F:F=#REF!),1)),"")
F4:F6F4=VLOOKUP(D4,Download!J:Q,8,FALSE)
F7F7=VLOOKUP(D13,Download!J:Q,8,FALSE)
E4:E6E4=COUNTIFS(Download!$F$1:$F$9999,B4,Download!$B$1:$B$9999,A4,Download!$J$1:$J$9999,D4)
E7E7=COUNTIFS(Download!$F$1:$F$9999,B6,Download!$B$1:$B$9999,A6,Download!$J$1:$J$9999,D13)
E8E8=SUM(E4:E7)
G4:G7,G10:G13G4=F4*E4
G8,G14G8=SUM(G4:G6)
D11:D12D11=IFERROR(INDEX(Download!J:J,AGGREGATE(15,6,ROW(Download!J:J)/(COUNTIF(B$4:D10,Download!D:D)=0)/(Download!F:F=B11),1)),"")
D13D13=IFERROR(INDEX(Download!J:J,AGGREGATE(15,6,ROW(Download!J:J)/(COUNTIF(B$4:D6,Download!D:D)=0)/(Download!F:F=B4),1)),"")
 

Attachments

  • Screenshot 2021-01-28 162710.png
    Screenshot 2021-01-28 162710.png
    123.2 KB · Views: 11
  • Screenshot 2021-01-28 162732.png
    Screenshot 2021-01-28 162732.png
    57.5 KB · Views: 11

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,184
Members
453,020
Latest member
Mohamed Magdi Tawfiq Emam

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