+ Reply to Thread
Results 1 to 15 of 15

How execute formula using data from A1 to A... (until empty cell in B)

  1. #1
    Registered User
    Join Date
    06-16-2008
    Posts
    10

    How execute formula using data from A1 to A... (until empty cell in B)

    Hi,
    I have tried searching for a solution to my problem, but I can't even figure out how to describe my issue simply enough to get relevant search results.

    Please Login or Register  to view this content.
    My formula in this case would be [sum(B1:B3)-sum(A1:A3)]/sum(A1:A3).
    However, if there was a number at B4, then the formula would be [sum(B1:B4)-sum(A1:A4)]/sum(A1:A4).
    If there was a number at B5, then the formula would be [sum(B1:B5)-sum(A1:A5)]/sum(A1:A5).
    * There will never be a gab in between two rows. So B1=160, B2=140, B4=100 is impossible.

    So how can I make a formula that will always work no matter if colum B goes all the way down to 2...6,7 or 8?

    Thanks

  2. #2
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How execute formula using data from A1 to A... (until empty cell in B)

    Try

    =(SUM(B:B)-SUMIF(B:B,"<>",A:A))/SUMIF(B:B,"<>",A:A)

  3. #3
    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 execute formula using data from A1 to A... (until empty cell in B)

    Hi there. try this:
    =(SUM(B:B)-SUMIF(B:B,">"&0,A:A))/SUMIF(B:B,">"&0,A:A)
    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

  4. #4
    Registered User
    Join Date
    06-16-2008
    Posts
    10

    Re: How execute formula using data from A1 to A... (until empty cell in B)

    Ok, I didn't think it would matter for the answer, but in fact the range is not from A1:A9...it's from A35:A46. A1:A9 was only for my example.

  5. #5
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How execute formula using data from A1 to A... (until empty cell in B)

    Try
    =(SUM(B$35:B$46)-SUMIF(B$35:B$46,"<>",A$35:A$46))/SUMIF(B$35:B$46,"<>",A$35:A$46)

  6. #6
    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 execute formula using data from A1 to A... (until empty cell in B)

    =(SUM(B35:B46)-SUMIF(B35:B46,"<>",A35:A46))/SUMIF(B35:B46,"<>",A35:A46)

    will do that.
    Last edited by Glenn Kennedy; 08-29-2016 at 11:32 AM.

  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 execute formula using data from A1 to A... (until empty cell in B)

    Jonmo, I'm slowing up. You beat me by a minute this time!!

  8. #8
    Forum Guru Jonmo1's Avatar
    Join Date
    03-08-2013
    Location
    Bryan, TX
    MS-Off Ver
    Excel 2010
    Posts
    9,763

    Re: How execute formula using data from A1 to A... (until empty cell in B)

    And I even typed more characters (in the formula)...Woo Hoo.

  9. #9
    Registered User
    Join Date
    06-16-2008
    Posts
    10

    Re: How execute formula using data from A1 to A... (until empty cell in B)

    haha thanks guys.

    Would you care to explain? <> is "no equal to". But cells in B and A are not equal even if the cells in B are not empty. So what does it check exactly?

  10. #10
    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,812

    Re: How execute formula using data from A1 to A... (until empty cell in B)

    " < > " is shorthand for "is not blank".

    Hope this helps!
    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.

  11. #11
    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 execute formula using data from A1 to A... (until empty cell in B)

    "<>" means anything other than blank. Or you could use my original version >0... but that might not be as clever if zero values are possible.

  12. #12
    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 execute formula using data from A1 to A... (until empty cell in B)

    ...now 2 mins behind a latecomer to the field.

  13. #13
    Registered User
    Join Date
    06-16-2008
    Posts
    10

    Re: How execute formula using data from A1 to A... (until empty cell in B)

    Oh I thought <> was "not equal to"... "not blank" makes more sense in the formula...

    Thanks!

  14. #14
    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,812

    Re: How execute formula using data from A1 to A... (until empty cell in B)

    @Glenn - big LOL!!!

  15. #15
    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,812

    Re: How execute formula using data from A1 to A... (until empty cell in B)

    Quote Originally Posted by elite_thut View Post
    Oh I thought <> was "not equal to"... "not blank" makes more sense in the formula...

    Thanks!
    It does, and another way of putting it is "is not equal to blank"!!!

+ 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] Paste formula to the last empty cell based on a non-empty cell on another column
    By bhenlee in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 04-02-2015, 04:07 PM
  2. Leaving a cell (with formula) displaying as empty if theres data in another cell
    By bluenose_1878 in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-27-2015, 12:27 PM
  3. [SOLVED] Automatic code to execute only if certain cell is empty
    By kosherboy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-25-2014, 10:49 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. Need help with formula to copy data from another cell only if the cell is empty
    By mendoza1964 in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-17-2012, 07:13 PM
  6. Replies: 3
    Last Post: 01-04-2012, 02:19 PM
  7. [SOLVED] Execute only if data in certain cell changes
    By JimDandy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-02-2010, 11:22 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