Formula returns array rather than value

excelmonky12345

New Member
Joined
Sep 22, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I'm trying to SUMIF values in another sheet (therefore the indirect), however the keys are different so I need to map the keys (therefore the Index Match)).

Suppose there are two sheets, sheetA and sheetB and sheetC

sheetA is below, I'm trying to fill out Total Money
PersonTotal Money
Tim
Bob

sheetB is as follows:
PersonMoney
Timothy5
Robert1
Robert1
Timothy5

Sheet C is a map
Key1Key2
TimothyTim
RobertRob

Essentailly, in my model I have a ton of sheetB's and only 1 sheetA, so we must map the keys in sheetB to correspond to sheetA (rather than vice versa). And I'm using a formula to write many indirects. But for the sake of example,

=SUMIFS(INDIRECT(F2),INDEX(sheetC!$B$2:$B$3,MATCH(INDIRECT(E2),sheetC!A2:A3,0)),A2)

The above formula should return a value, but it instead returns an array and I'm really flabbergasted as to why.

The problem is the indirect in the index match formula, if we seperate that out and do:

=SUMIFS(INDIRECT(F2),E12#,A2)

Where E12# is the formula: =INDEX(sheetC!$B$2:$B$3,MATCH(INDIRECT(E2),sheetC!A2:A3,0))

The formula works perfectly fine. But this just confuses me more, because all I've done is broken the formula into two parts.

Does anyone understand why it might not be working as we might want?
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
I'm trying to SUMIF values in another sheet (therefore the indirect), however the keys are different so I need to map the keys (therefore the Index Match)).

Suppose there are two sheets, sheetA and sheetB and sheetC

sheetA is below, I'm trying to fill out Total Money
PersonTotal Money
Tim
Bob

sheetB is as follows:
PersonMoney
Timothy5
Robert1
Robert1
Timothy5

Sheet C is a map
Key1Key2
TimothyTim
RobertRob

Essentailly, in my model I have a ton of sheetB's and only 1 sheetA, so we must map the keys in sheetB to correspond to sheetA (rather than vice versa). And I'm using a formula to write many indirects. But for the sake of example,

=SUMIFS(INDIRECT(F2),INDEX(sheetC!$B$2:$B$3,MATCH(INDIRECT(E2),sheetC!A2:A3,0)),A2)

The above formula should return a value, but it instead returns an array and I'm really flabbergasted as to why.

The problem is the indirect in the index match formula, if we seperate that out and do:

=SUMIFS(INDIRECT(F2),E12#,A2)

Where E12# is the formula: =INDEX(sheetC!$B$2:$B$3,MATCH(INDIRECT(E2),sheetC!A2:A3,0))

The formula works perfectly fine. But this just confuses me more, because all I've done is broken the formula into two parts.

Does anyone understand why it might not be working as we might want?

Not sure what you are trying to achieve using INDIRECT, but give this a try, and adjust the sheet names to suit your data:

Excel Formula:
=SUMIF(Sheet2!$A$2:$A$5,INDEX(Sheet3!$A$2:$A$3,MATCH(A2,Sheet3!$B$2:$B$3,0)),Sheet2!$B$2:$B$5)

I used the default sheet names, Sheet1, Sheet2, Sheet3, but they correspond with your Sheet A, Sheet B, Sheet C.
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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