+ Reply to Thread
Results 1 to 7 of 7

Use a Defined Name formula, depending on a cell value

  1. #1
    Registered User
    Join Date
    06-09-2016
    Location
    Somewhere south
    MS-Off Ver
    2013
    Posts
    3

    Question Use a Defined Name formula, depending on a cell value

    Hello.

    Does anyone know how to use a defined name formula depending on a cell value, without using nested if's?

    I have at least 10 categories, (Column B) and depending on the category I need to use a huge formula. (Defined Name)

    When I only had 3 categories, I used a nested if formula, but now I have 10 categories and growing.
    The Categories match the Defined Formulas.
    ex.
    Category To use Defined Formula
    Wood =Wood
    Metal =Metal
    Liquid =Liquid

    Thank you!!!

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 insider Version 2505 Win 11
    Posts
    24,754

    Re: Use a Defined Name formula, depending on a cell value

    Your request is pretty vague, but I am guessing that a VBA solution using Select Case may be what you need. Please supply a sample worksheet with an explanation of what you need to happen (expected results) and I am sure that one of our experienced volunteers will lead you to a proper solution.

    Attach a sample workbook. Make sure there is just enough data to demonstrate your need. Include a BEFORE sheet and an AFTER sheet in the workbook if needed to show the process you're trying to complete or automate. Make sure your desired results are shown, mock them up manually if necessary.

    Remember to desensitize the data.

    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    06-09-2016
    Location
    Somewhere south
    MS-Off Ver
    2013
    Posts
    3

    Re: Use a Defined Name formula, depending on a cell value

    Attached the example of what I currently use. (rows 2 thru 4)
    and what I expect ( from row 9)
    the example of what the result I need to be done automatic is Row 8

    I rather not use VBA

    Thanks!!!
    Attached Files Attached Files

  4. #4
    Forum Guru
    Join Date
    04-13-2005
    Location
    North America
    MS-Off Ver
    2002/XP, 2007, 2024
    Posts
    16,443

    Re: Use a Defined Name formula, depending on a cell value

    More detail about the named formula? Exactly what you have could be accomplished by =CONCATENATE(B9,"_Formula") and not use the named formula.

    A lookup table + function is often a good replacement for multiple nested ifs. https://support.office.com/en-us/art...8-93a18ad188a1 I think a lot depends on what that named formula is really doing.
    Quote Originally Posted by shg
    Mathematics is the native language of the natural world. Just trying to become literate.

  5. #5
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 V 2504
    Posts
    13,744

    Re: Use a Defined Name formula, depending on a cell value

    Was typing and copying while MrShorty posted.

    Something like this?

    Press the F3 function key and paste named formulas. Here it is in columns H:I.

    Then this formula in C8 and filled down.
    Formula: copy to clipboard
    Please Login or Register  to view this content.



    B
    C
    D
    E
    F
    G
    H
    I
    1
    Ash
    ="Ash_Formula"
    2
    Mahogany
    when ony 3 categories
    Mahogany_Formula
    Birch
    ="Birch_Formula"
    3
    Walnut
    Walnut_Formula
    Mahogany
    ="Mahogany_Formula"
    4
    Oak
    Oak_Formula
    Maple
    ="Maple_Formula"
    5
    Oak
    ="Oak_Formula"
    6
    What to expect
    Walnut
    ="Walnut_Formula"
    7
    8
    Ash
    Ash_Formula
    In C8: =IFERROR(SUBSTITUTE(SUBSTITUTE(VLOOKUP(B8,$H$1:$J$6,2,FALSE),"""",""),"=",""),"")
    9
    Birch
    Birch_Formula
    10
    Maple
    Maple_Formula
    11
    Cherry
    12
    Pine
    13
    Spruce
    14
    Cedar
    15
    Fir
    16
    Larch
    17
    Plywood
    18
    Fiberboard
    19
    ChipBoard
    Dave

  6. #6
    Registered User
    Join Date
    06-09-2016
    Location
    Somewhere south
    MS-Off Ver
    2013
    Posts
    3

    Re: Use a Defined Name formula, depending on a cell value

    Thank you for your help MrShorty and FlameRetired.

    What I need is to call the named formula, so it can do the needed operation.
    the "wood_formula" text is just an example of data contained in the named formula.

    Thank you again.
    Last edited by karlhesse; 02-06-2018 at 04:23 PM.

  7. #7
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Use a Defined Name formula, depending on a cell value

    May I ask why VBA is to be avoided? It will be the simplest solution, I think, though you could also do it in a less flexible way with an XLM function. Either way the file would need to be saved in macro-enabled format.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. [SOLVED] VBA, User-defined formula argument referring to cell value calculated by Excel formula
    By ARAGORN II in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-23-2017, 01:57 PM
  2. Formula to change colour AND text in cell depending on value in adjacent cell
    By helsbels44 in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 04-01-2017, 11:03 AM
  3. Generate excel reports depending on user defined values
    By Parth007 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-10-2016, 03:01 AM
  4. VBA pop-up box depending on time of day - ranges to be defined
    By dancing-shadow in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 03-24-2014, 11:18 AM
  5. Macro code to copy depending on the value defined.
    By N Prakash in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-01-2013, 04:29 AM
  6. Replies: 8
    Last Post: 02-21-2013, 05:16 PM
  7. Replies: 8
    Last Post: 05-19-2005, 07:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1