naming a function same way naming a range

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I have nested if() i.e. =if(cond1, "a", if(cond2,"b",if(cond3,"c",f)))
I want to know if I can name that function to for example XYZ and use that name to pass it to another function instead of passing the whole function. Similar idea of naming a range A1:A20 as ABC and then use it as =sum(ABC). Thank you.
 

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
You can name the cell that formula is in, and then refer to that name in another formula. You can't name the actual formula and then use it like "=MyFormula(A1) ", no...is that what you're asking?
 
Last edited:
Upvote 0
Yes, you can do that. In the 'Refers to' box, just type in the formula as you would type it into a cell. However, as I tested it, the formula got messed up after first entry, so I had to go back into the Name Manager and fix the ranges.

By doing this, the name then references the result of the formula you put in.

Here's what I did:

I made an entry in the Name Manager for this formula and named it "Fives" and typed that formula into the "Refers To" box:

=IF(B1="x",B2,IF(C1="x",C2,D2))

The SUM formula then returned the sum of E2 and whatever the result of my formula was, 5, 10, 55, etc.

And after further testing, you don't even need to put the named formula on the sheet anywhere.
A
B
C
D
E
F
1
named formula here
x
2
5
10
55
100
=SUM(Fives,E2)

<tbody>
</tbody>
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,653
Messages
6,120,751
Members
448,989
Latest member
mariah3

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