Reference in a formula

reddolls

Board Regular
Joined
Feb 20, 2007
Messages
53
Hello.

I have following array formula in a spreadsheet I am using:

=SUM((MasterList!$H$9:$H$500 = I$6)*(MasterList!$K$9:$K$500 = $B$7)*SevenEight)

The end part of the formula "SevenEight" references a named selection of cells. What I would like to do is replace that with "EighNine" or "NineTen" depending on the year the user selects.

I am not sure how to get the last part to reference a different range name depending on what a user selects?

Thanks if you can help and sorry if the question is not particularly clear!

Rich
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.

pgc01

MrExcel MVP
Joined
Apr 25, 2006
Messages
19,887
Hi Rich

Not sure I understood exactly so I lay my assumptions:

Assuming

- the range N9:N500 has the dates corresponding to the values
- The user writes the year in B1
- If the user chooses 2006 you want to sum the values of EighNine, if 2007 you want to sum the values of NineTen

The result in B2 is

=SUM((MasterList!$H$9:$H$500=I$6)*(MasterList!$K$9:$K$500=$B$7)*((YEAR(MasterList!$N$9:$N$500)=B1)*(B1=2006)*EighNine+(YEAR(MasterList!$N$9:$N$500)=B1)*(B1=2007)*NineTen))

... as an array formula.

Hope this helps
PGC
 

Forum statistics

Threads
1,181,658
Messages
5,931,272
Members
436,786
Latest member
Deniel

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
Top