+ Reply to Thread
Results 1 to 8 of 8

How do I exclude a cell from a formula using macros

  1. #1
    Registered User
    Join Date
    08-22-2022
    Location
    uk
    MS-Off Ver
    2016
    Posts
    4

    How do I exclude a cell from a formula using macros

    Hello, apologies if something similar has been asked before


    I have a spreadsheet that we use in the lab for pooling samples based on concentration, sometimes the concentration is low enough that it skews the final pool and it needs to be removed from the calculations and just added manually... What I want to know is is there a way to use tickboxes (for example) to remove a sample from a formula, as often there are a number of samples that need removing and it is a pain to do this manually.

    I've attached a basic template to show what I mean. The formulas in F98 to H98 are the ones I am talking about, I want to be able to remove a few samples from the calculation without going in and editing the formula every time.

    Thanks in advanced

    Meg
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    05-30-2012
    Location
    The Netherlands
    MS-Off Ver
    Office 365
    Posts
    14,987

    Re: How do I exclude a cell from a formula using macros

    Not a VBA solution.


    Add the results in row 1 instead of in row 98.

    See the attached file.
    Notice my main language is not English.

    I appreciate it, if you reply on my solution.

    If you are satisfied with the solution, please mark the question solved.

    You can add reputation by clicking on the star * add reputation.

  3. #3
    Registered User
    Join Date
    08-22-2022
    Location
    uk
    MS-Off Ver
    2016
    Posts
    4

    Re: How do I exclude a cell from a formula using macros

    I don't know how to work forums lol I just need to remove this but not sure how
    Last edited by megan145; 09-09-2022 at 04:35 AM.

  4. #4
    Registered User
    Join Date
    08-22-2022
    Location
    uk
    MS-Off Ver
    2016
    Posts
    4

    Re: How do I exclude a cell from a formula using macros

    Hi,

    Sorry I'm not sure that solves the problem. I would still have to manually change the formula in the cells in order to remove samples from the calculation.

    What I want to avoid is having to change the formula to something messy like =SUM(H2:H17,H19:H38,H40:H42,H45:H48,H52:H62,H64:H76,H79:H92,H94:H97) which is what I have to do at the moment to remove samples from the calculation. Is there many an IF clause that would help me better than VBA?

    Thanks

  5. #5
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: How do I exclude a cell from a formula using macros

    Change the formula in F2, to:
    =IFERROR((147/D2)*C2,"")

    to remove ugly errors.

    Add an extra column (column I), x or anything, to exclude values, and sum using:

    =SUMIF(I2:I97,"",F2:F97)
    Attached Files Attached Files
    Glenn




    None of us get paid for helping you... we do this for fun. So DON'T FORGET to say "Thank You" to all who have freely given some of their time to help YOU.

    Temporary addition of accented to illustrate ongoing problem to the TT: L? fh?ile P?draig sona dhaoibh

  6. #6
    Registered User
    Join Date
    08-22-2022
    Location
    uk
    MS-Off Ver
    2016
    Posts
    4

    Re: How do I exclude a cell from a formula using macros

    This is great, a much simpler solution to my problem than I thought I was looking for

    Thank you!

  7. #7
    Forum Moderator Glenn Kennedy's Avatar
    Join Date
    07-08-2012
    Location
    Digital Nomad... occasionally based in Ireland.
    MS-Off Ver
    O365 (PC) V 2403
    Posts
    44,036

    Re: How do I exclude a cell from a formula using macros

    You're welcome.



    It would be very nice if you were to just click the Add Reputation button at the foot of any of the posts of members who helped you reach a solution.

    Finally, if that takes care of your original question, please click on "Thread Tools" from the menu link (just above the first post in the thread) and mark this thread as SOLVED.

  8. #8
    Forum Expert bebo021999's Avatar
    Join Date
    07-22-2011
    Location
    Vietnam
    MS-Off Ver
    Excel 2016
    Posts
    9,466

    Re: How do I exclude a cell from a formula using macros

    You need to input few mock up data, and point out the expected outcome. All formulas in column F:H display errors.
    Quang PT

+ 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. Exclude a cell from Large formula
    By Merle Ann in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 12-29-2021, 11:17 PM
  2. Replies: 4
    Last Post: 08-06-2018, 07:54 AM
  3. Intelligent Macros (exclude values etc)
    By testadimissile in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-18-2017, 08:07 PM
  4. Formula to exclude a cell from being calculated, but still appear visually.
    By EdwinK_92 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 08-06-2015, 11:38 AM
  5. [SOLVED] Exclude macros from triggering msgbox
    By Jamesera27 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-04-2015, 11:43 PM
  6. Exclude Blank Cell from Formula
    By Executive in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 09-25-2012, 03:53 PM
  7. Exclude cell from formula by formatting?
    By Montrose77 in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 02-22-2005, 04:39 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