+ Reply to Thread
Results 1 to 13 of 13

Outcome of a formula as value for a variable

  1. #1
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Outcome of a formula as value for a variable

    So I know how I can make a variable from a cell value like :"
    Please Login or Register  to view this content.
    And if in A6 there is a formula it will take the outcome of the formula.

    However...what if I don't wont to make the cell with the formula.
    Can I directly load the outcome of formula into a variable?

    This is my formula:
    Please Login or Register  to view this content.
    So ideal would be :
    Please Login or Register  to view this content.
    But obviously that will not work

  2. #2
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Outcome of a formula as value for a variable

    You could do
    Please Login or Register  to view this content.
    or
    Please Login or Register  to view this content.

  3. #3
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Outcome of a formula as value for a variable

    Or
    Please Login or Register  to view this content.

  4. #4
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Outcome of a formula as value for a variable

    looks nice...but returns 0 if I use a msbox.
    the value it should return is 1126

    * That was for StephenR's reply

  5. #5
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Outcome of a formula as value for a variable

    No it shouldn't, have you checked what the COUNT formula does?

  6. #6
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Outcome of a formula as value for a variable

    Well the excel formula is :
    =(COUNT($Z:$Z)*2)
    This ones gives 1126 because there are 563 values in column Z

    Record macro makes :
    ActiveCell.FormulaR1C1 = "=(COUNT(C26)*2)"

  7. #7
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Outcome of a formula as value for a variable

    Eh? Why are you using C26 - just use Z:Z in what I posted.

  8. #8
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Outcome of a formula as value for a variable

    Actually AB33's solution also returns 0....

    I run the macro direct on the sheet where it needs to be so it cannot be that it looks in column Z of another sheet right?

    This is the simple macro :
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Outcome of a formula as value for a variable

    Quote Originally Posted by StephenR View Post
    Eh? Why are you using C26 - just use Z:Z in what I posted.
    Well that did work, thanks!

    But I used C26 because when I recorde the formula it converted Z:Z to C26.....

  10. #10
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Outcome of a formula as value for a variable

    Also AB33 solution workd with "Z:Z"

    Thanks you both!

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Outcome of a formula as value for a variable

    Count function counts the values in a cell. If you have a formula in C26, they can only be one count as there is only single cell you are counting.

  12. #12
    Forum Contributor
    Join Date
    07-26-2012
    Location
    Netherlands
    MS-Off Ver
    Excel 2016 Office 365 ProPlus
    Posts
    822

    Re: Outcome of a formula as value for a variable

    Ok thanks for explanation.

    Still strange that when you record that formula it comes up with C26.
    I uses C26 of course because column Z is the 26st column.

  13. #13
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: Outcome of a formula as value for a variable

    I see now, you were using RC notation.

+ 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] Tripple outcome formula
    By tbenge05 in forum Excel Formulas & Functions
    Replies: 13
    Last Post: 03-21-2014, 11:48 AM
  2. [SOLVED] Help required with IF functions - adding an extra variable and outcome
    By JoeSmart in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-20-2013, 07:39 AM
  3. Multiple outcome IF formula
    By dm1983 in forum Excel General
    Replies: 2
    Last Post: 06-20-2010, 12:11 PM
  4. Incorrect formula outcome
    By leonidas in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-27-2006, 09:25 AM
  5. format the outcome of a formula
    By tinester in forum Excel General
    Replies: 3
    Last Post: 04-12-2006, 03:10 PM

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