Array that can pull data from different ranges

xcl1997

New Member
Joined
Sep 12, 2022
Messages
11
Office Version
  1. 365
Platform
  1. Windows
{=SUM(INDIRECT("'sheet1'!"&SUBSTITUTE(ADDRESS(1,XMATCH(C$2,INDIRECT("'sheet1'!A1:"&SUBSTITUTE(ADDRESS(1,O1+16,4),"1","")&ROWS($M$1:$M$1)),0),4),"1","")&XMATCH($B3,INDIRECT("'sheet1'!$m$1:$m"&M1),0)):INDIRECT("'sheet1'!"&SUBSTITUTE(ADDRESS(1,XMATCH(C$2,INDIRECT("'sheet1'!A1:"&SUBSTITUTE(ADDRESS(1,O1+16,4),"1","")&ROWS($M$1:$M$1)),0),4),"1","")&XMATCH($B3+1,INDIRECT("'sheet1'!$m$1:$m"&M1),0)-1))}

The formula above is in C3 and is only the results part of the actual formula in the spreadsheet. The actual formula has to conditions - one for if the date in row B equals the max date in row M, and another for when the row B date is less than the row M max. To save space, I've only posted the result for when row B is less than row K.

By using "indirect", the Table 1 C3 formula can be copied and pasted to the rest of the cells in the table (without having to make an adjustment for each row because of the different cell ranges for dates in Table 2).

Is there a way to adjust the C3 formula so that it acts like an array that automatically calculates the rest of the cells going either across each row (so there is only a need to copy and paste down column C) or down column C (so there is only a need to copy and paste going across row 3)?
 

Attachments

  • mrexcelimage.gif
    mrexcelimage.gif
    123.7 KB · Views: 7

Excel Facts

How to change case of text in Excel?
Use =UPPER() for upper case, =LOWER() for lower case, and =PROPER() for proper case. PROPER won't capitalize second c in Mccartney
Should mention - Table 1 title says the total sum is for column AA thru AT food. It should say for columns P thru W.
 
Upvote 0

Forum statistics

Threads
1,214,812
Messages
6,121,693
Members
449,048
Latest member
81jamesacct

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