Copy Sheet Creates Copies of Lambda Functions in Name Manager

MikeMcCollister

Board Regular
Joined
May 6, 2020
Messages
71
Office Version
  1. 365
Platform
  1. Windows
I have recently discovered the filter function in Excel. What a wonderful edition! Because of this, I am working to remove VBA from my budget spreadsheet. I'm also creating some Lambda functions using the name manager for my new functions. All my Lambda functions use the Workbook scope. When I copy an existing sheet, like January so that I can rename it to February, all the Lambda functions are duplicated and are scoped to the newly copied sheet. Any ideas how to prevent this from happening?

Thanks,

Mike
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
Excel does not always duplicate the Lambda formula.
How are you producing the new sheet?
Can you post an example of the formula?
N.B. You can post a concise example with the forum's tool named XL2BB.
 
Upvote 0
Do you have any ranges hard-coded into the function?
 
Upvote 0
I'll try this without using XL2BB as this is a multi-tab spreadsheet.

First sheet is called "January" and totals up each category from the second sheet "Checking". Note that B1 contains the month number for the month name in A1. I have a Lambda function in the named CategoryTotalForMonth. The Lambda function is as follows:

Code:
=LAMBDA(month_num,category, SUM(FILTER(Checking[Amount],(Checking[Category]=category)*(Checking[Month]=month_num))))

This function has the scope of Workbook.

When I copy the January sheet (using ctrl-drag) and rename to February (also change A1 to February) I see that CategoryTotalForMonth has a duplicate in the Name Manager with a scope of "February".

1707679707110.png


1707679733178.png


I just don't want global lambda functions to be duplicated.

Thanks,

Mike
 
Upvote 0
I think that's the reason. You will probably need to pass those ranges to the function in the same way you pass month_num & category.
 
Upvote 0
I think that's the reason. You will probably need to pass those ranges to the function in the same way you pass month_num & category.
Fluff,

Thanks. That is unfortunate. In my actual document, I am referencing multiple columns. I was trying to make the formulas look much cleaner.

I guess that each time I copy a month sheet I can prune the newly created names.

Mike
 
Upvote 0

Forum statistics

Threads
1,215,069
Messages
6,122,956
Members
449,096
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