Selecting a names range based on variable in SUMIFS formula

pete333

New Member
Joined
Aug 16, 2014
Messages
15
Hi

I have the following formula:

=SUMIFS(marginjuly,conjuly,K$1)

where K$1 is the name of the consultant,


This currently looks at my data in "marginjuly" and adds up all the results of matching consultant

eg:

Consultant Name
[TABLE="width: 500"]
<tbody>[TR]
[TD]consjuly
[/TD]
[TD]marginjuly[/TD]
[TD]Month
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Peter
[/TD]
[TD]1000
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Peter
[/TD]
[TD]500
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John
[/TD]
[TD]1200
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sue
[/TD]
[TD]11
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John
[/TD]
[TD]500
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Peter
[/TD]
[TD]750
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Peter
[/TD]
[TD]955
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]John
[/TD]
[TD]300
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
[TR]
[TD]Sue
[/TD]
[TD]50
[/TD]
[TD]July
[/TD]
[TD][/TD]
[/TR]
</tbody>[/TABLE]

The formula nicely gets me the consultant margin for the month indicated, but i would like to be able to change the month and have the formula change with the month variable.

so august would need to look like this: =SUMIFS(marginaugust,conaugust,K$1)

How can I selected a range within the formula based on a date variable.

I know i could possibly change my raw data and simply use multiple criteria in the sumifs formula, however I already have this set up in names ranges throughout spreadsheet.

Thanks

Peter
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi Peter,

Welcome to Mr. Excel Forum.

I'm not sure if I understand what you need. See if this is Ok - assumes you have already set up named ranges for each month.

Since there is only one condition you can use SUMIF

=SUMIF(INDIRECT("con"&J1),K$1,INDIRECT("margin"&J1))

where J1 houses the month (July or August, for example) and K1 the name of consultant.

M.
 
Upvote 0
Actually that is almost perfect for what I need....it works if J1 is a text field... only challenge now is J1 is a date field... I tried this:

=SUMIF(INDIRECT("con"&MONTH(J1)),K$1,INDIRECT("margin"&MONTH(J1)))

So I would need to convert the month value of J1 to Text string. eg 9=September. is there an easy way?

Thanks

Peter


Hi Peter,

Welcome to Mr. Excel Forum.

I'm not sure if I understand what you need. See if this is Ok - assumes you have already set up named ranges for each month.

Since there is only one condition you can use SUMIF

=SUMIF(INDIRECT("con"&J1),K$1,INDIRECT("margin"&J1))

where J1 houses the month (July or August, for example) and K1 the name of consultant.

M.
 
Upvote 0
Try this

=SUMIF(INDIRECT("con"&TEXT(J1,"mmmm")),K$1,INDIRECT("margin"&TEXT(J1,"mmmm")))

M.
 
Upvote 0

Forum statistics

Threads
1,223,247
Messages
6,171,007
Members
452,374
Latest member
keccles

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