+ Reply to Thread
Results 1 to 21 of 21

Execute text in cell as formula

  1. #1
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Execute text in cell as formula

    Hi

    I got an issue , where I have been trying to find a way how to execute text in cell as formula without using INDIRECT or to be able to make it smarter as it is in my screenshot .

    I have a list with several options and when I choose one, I need to show different result and that result is combine with different cells which varies as well . Any idea how to make text in cell convert into formula , so I can match list number everytime to correct list cell and execute that cell for result. What I need is just idea how to avoid using INDIRECT or use it it smarter so I don't need to write INDIRECT for every cell. Thank you for any suggestion.

    Capture.JPG

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Execute text in cell as formula

    Any chance you could upload a sample workbook?

    Click on GO ADVANCED, scroll down and click Manage Attachments.
    If posting code please use code tags, see here.

  3. #3
    Forum Contributor
    Join Date
    07-28-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Execute text in cell as formula

    I would need more information. Right row, it looks like column J1 is just the formula
    =IF(F1="","",F1&G1&H1)
    copied down to J8. Then, cell C1 is the formula:
    =VLOOKUP(A1,$E$1:$J$8,6,FALSE)

  4. #4
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Re: Execute text in cell as formula

    Update.

    What I want to shorten this ridiculous long formula, because I have 24 option in my list and my result combination for one list is sometime combination of 6 cell and I need flexibility to rewrite just cell and convert into formula and insert instead INDIRECT

    =IF($A$2=1,INDIRECT(F2)&INDIRECT(G2)&INDIRECT(H2),IF($A$2=4,INDIRECT(F5)&INDIRECT(G5)&INDIRECT(H5),IF($A$2=7,INDIRECT(F8)&INDIRECT(G8)&INDIRECT(H8))))

    Capture.JPG
    Attached Images Attached Images

  5. #5
    Forum Contributor
    Join Date
    07-28-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Execute text in cell as formula

    [j1] =f1&g1&h1
    [j2] =f1&g1&h1
    [j4] =f4&g4&h4
    [j5] =f4&g4&h4
    [j7] =f7&g7&h7
    [j8] =f7&g7&h7

    [c1] =index($j$1:$j$8,$a$2)

  6. #6
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Re: Execute text in cell as formula

    OK this is good but it gives just cell value not executes the formula in cell with final value . What I need is result 123, abc or 11\1122\2233\33. Anyway thanks for something new

  7. #7
    Forum Contributor
    Join Date
    07-28-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Execute text in cell as formula

    Actually, my formula gives result 123, abc, or 11\1122\2233\33.

  8. #8
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Re: Execute text in cell as formula

    Sorry could you maybe make a screenshot from excel how it is written or just mail me that excel to my email kepo444 gmail.com please so I can have a quick look , I got a problem replicate it on my own. Thanks

  9. #9
    Forum Contributor
    Join Date
    07-28-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Execute text in cell as formula

    Quote Originally Posted by Kepo444 View Post
    Sorry could you maybe make a screenshot from excel how it is written or just mail me that excel to my email kepo444 gmail.com please so I can have a quick look , I got a problem replicate it on my own. Thanks
    Here you go!
    Attached Files Attached Files

  10. #10
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Re: Execute text in cell as formula

    Thanks but maybe I wasn't so clear about what I need . I just learn how to make attachment here is my excel . What I need is if is any way how to execute text in cell so for example I got in cell F1&G1&H1 and result will be in A1 so it will be 123 and I decided that I want to change it so I rewrite text in cell to point it into
    F4&G1&H1 so result will change in A1 into a23 . Is any way how to do it without using INDIRECT for any cell.
    Attached Files Attached Files

  11. #11
    Forum Contributor
    Join Date
    07-28-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Execute text in cell as formula

    How about this, I made it semicolon delimited.
    Attached Files Attached Files

  12. #12
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Re: Execute text in cell as formula

    I really appreciate your effort man , but that your way is even harder to write and understand that my , but you need to have a skill to be able to write formula like that How I said I got like 22 lists , so that is no way , you can write that for 22 list item, I need something easier, where part of the code will be in cell so I can rewrite that part anytime and execute in combination with formula with dependencies which list i pick. So I am going to have if(list1,If(list2,If(list3,If(list4)))) and when I rewrite text in cell which is list1 it will be change automatically.

  13. #13
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Execute text in cell as formula

    Please Login or Register  to view this content.
    Ben Van Johnson

  14. #14
    Forum Contributor
    Join Date
    07-28-2012
    Location
    USA
    MS-Off Ver
    Excel 2007
    Posts
    104

    Re: Execute text in cell as formula

    Quote Originally Posted by Kepo444 View Post
    I really appreciate your effort man , but that your way is even harder to write and understand that my , but you need to have a skill to be able to write formula like that How I said I got like 22 lists , so that is no way , you can write that for 22 list item, I need something easier, where part of the code will be in cell so I can rewrite that part anytime and execute in combination with formula with dependencies which list i pick. So I am going to have if(list1,If(list2,If(list3,If(list4)))) and when I rewrite text in cell which is list1 it will be change automatically.
    Explain what you actually want, and we can help you do it. We can only provide solutions to what you tell us. What do you mean you have 22 list items? Give us a better example, and we can show you how to get what you want.

  15. #15
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Re: Execute text in cell as formula

    OK I will try to explain it once again with new excel. Hope so will be more clearer from that. What I am really trying to achieve is have a result which I can change with text change in cell not in formula and able to apply it for all line in list below .

    Capture.JPG
    Attached Files Attached Files

  16. #16
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Re: Execute text in cell as formula

    Hi

    I see it now. I have been playing with this and this is exactly what I need it =choose . Thank you sir.

  17. #17
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,613

    Re: Execute text in cell as formula

    Another option:
    Named range:
    List =Sheet2!$X$1:$X$4
    Named Formulas:

    List_01 =!$J11&!$M11&!$N11&!$S11
    List_02 =!$L18
    List_03 =(!$J25&!$O25&!$P25&!$R25)
    list_04 =!$L32&!$O32
    Result =EVALUATE(!$A$1)


    Create the named formulas referring to each table as above.
    Create the named formula, "RESULT" to evaluate the named formulas picked from the dropdown in A1

    Save the workbook as xlsm
    Attached Files Attached Files

  18. #18
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Re: Execute text in cell as formula

    As well very interesting approach into solve this challenge and thanks for sharing. I guess there is no direct way how to execute cell value as formula or part of the formula. Anyway thank you for all your reply , I can move forward with this new knowledge and learnt few new things. Really appreciate.

  19. #19
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Execute text in cell as formula

    If that takes care of your original question, please select Thread Tools from the menu link above and mark this thread as SOLVED. Thanks.
    Ali


    Enthusiastic self-taught user of MS Excel who's always learning!
    Don't forget to say "thank you" in your thread to anyone who has offered you help.
    You can reward them by clicking on * Add Reputation below their user name on the left, if you wish.

    Forum Rules (updated August 2023): please read them here.

  20. #20
    Registered User
    Join Date
    03-01-2018
    Location
    Bratislava
    MS-Off Ver
    2016
    Posts
    10

    Re: Execute text in cell as formula

    So after playing with this I was able to find exactly what I was looking for. I have created in Name Manager new compartment for every case I will be needed and use evaluate =EVALUATE(Reports!$C$12) , =EVALUATE(Reports!$C$19), =EVALUATE(Reports!$C$26), etc and =CHOOSE(_listNumber,DM_ISOM_001,DM_ISOM_002,DM_ISOM_003,DM_ISOM_004). So now when I update cell it will update my result whatever I at that moment need. Thank you

    Capture.JPG

  21. #21
    Forum Moderator AliGW's Avatar
    Join Date
    08-10-2013
    Location
    Retired in Ipswich, Suffolk, but grew up in Sawley, Derbyshire (England)
    MS-Off Ver
    MS 365 Subscription Insider Beta Channel v. 2404 (Windows 11 22H2 64-bit)
    Posts
    80,940

    Re: Execute text in cell as formula

    Thanks for the useful update!

+ 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] If CELL is blank the execute formula1, IF Cell is not blank execute formula 2
    By grahamlees in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-13-2017, 06:47 AM
  2. Execute formula written as text in another cell
    By Iulian Panosche in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 11-21-2016, 07:35 AM
  3. Execute formula if certain text appears in another column
    By qhoney in forum Excel Formulas & Functions
    Replies: 7
    Last Post: 04-15-2014, 01:06 PM
  4. VBA won't execute when formula changes cell value
    By Intern2 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 12-30-2013, 06:50 PM
  5. Execute Now fomula based on text in another cell
    By Joker757 in forum Excel General
    Replies: 2
    Last Post: 05-02-2012, 08:20 AM
  6. Auto execute a macro to trigger when text is written in a cell
    By mhickey in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 03-02-2012, 04:56 PM
  7. Modify formula to not execute if cell contains certain text
    By icets in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 06-26-2011, 08:59 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