Share via

SUMIF and Dynamic Reference

Anonymous
2012-06-27T18:18:03+00:00

I have a range of data named data_6120 and the column to sum is named datasum_6120 where 6120 is an account number.

As I have several account numbers, I would like to have the account number in B2.  And write the formula in b4 as   sumif("data_"&b2,a4,"datasum_"&b2).  If a simple ="data_"&b2 brings back data_6120, how do I make the sumif dynamic?  The criteria in cell A4 will always be static and a range name exists for each account number.

Microsoft 365 and Office | Excel | For home | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

Anonymous
2012-06-27T19:13:54+00:00

I have a range of data named data_6120 and the column to sum is named datasum_6120 where 6120 is an account number.

As I have several account numbers, I would like to have the account number in B2.  And write the formula in b4 as   sumif("data_"&b2,a4,"datasum_"&b2).  If a simple ="data_"&b2 brings back data_6120, how do I make the sumif dynamic?  The criteria in cell A4 will always be static and a range name exists for each account number.

Try this formula:

=SUMIF(INDIRECT("data_"&B2),A4,INDIRECT("datasum_"&B2))

Hope this helps / Lars-Åke

Was this answer helpful?

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2012-06-27T19:12:34+00:00

Are the ranges data_6120 etc. defined as a fixed range, for example

=Sheet3!$B$1:$B$50

or as a dynamic formula, e.g.

=OFFSET(Sheet3!$B$2, 0, 0, COUNTA(Sheet3!$B$2:$B$1000), 1)

If the former, you can use the INDIRECT function. That won't work with dynamically defined names though.

Was this answer helpful?

0 comments No comments

0 additional answers

Sort by: Most helpful