I have a formula below that search a range (A5:A1000) (C5:N1000) (A5:A1000) I discovered that I need to add 24 separate ranges for each range and I need help on how to write it in.

Existing formula

=IF(A3="","",INDEX(Distro!$A$5:$A$1000,SUMPRODUCT(--(Distro!$C$5:$N$1000=A3)*(ROW(Distro!$A$5:$A$1000)-4))))

I need to add 24 ranges for each of the 3 ranges. Example below:

(A5:A40) (C5:C40) (A5:A40)

(A45:A80) (C45:C80) (A45:A80)

(A85:A125) (C85:C125) (A85:A125) and so on...

And the same here just for this part (Distro!$C$5:$N$1000=A3)

=IF(A3="","",INDEX(Distro!$C$4:$N$4,SUMPRODUCT(--(Distro!$C$5:$N$1000=A3)*(COLUMN(Distro!$C$5:$N$5)-2))))

(C5:N40)

(C45:N80)

(C85:C125) and so on:

I would greatly appreciate it if someone could give me an example on adding in 2 ranges and then I could figure out the rest.

Greatly appreciated!