Closed Thread
Results 1 to 28 of 28

sum if formula works as array but running non-stop as VBA

  1. #1
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    sum if formula works as array but running non-stop as VBA

    Hey community,

    Please Login or Register  to view this content.
    I use this formula = [sum(if((isnumber(match(list1,market,0)))*(list2>0)*(list1<>"")*(not(isnumber(match(list4,list3,0)))),printed))] as array it works fine, but when i try it with VBA it is running non-stop
    AP:AP is from AP1 to AP31 numeric
    E:E is full list

    Can anybody help me please?

  2. #2
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    Please Login or Register  to view this content.
    ridiculous...

  3. #3
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: sum if formula works as array but running non-stop as VBA

    what do you mean?

  4. #4
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    Ask in the Formula forum.

  5. #5
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: sum if formula works as array but running non-stop as VBA

    ok but as formula it works fine..

  6. #6
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    Then why don't you enter a formula in the cell?

  7. #7
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: sum if formula works as array but running non-stop as VBA

    because customers will use this file, they might delete formula by mistake

  8. #8
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    1) Normally formula in the cell is the fastest.
    2) You can always convert formula to a value after the calculation, so no formula remains.

  9. #9
    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,647

    Re: sum if formula works as array but running non-stop as VBA

    Quote Originally Posted by jindon View Post
    Please Login or Register  to view this content.
    ridiculous...
    Frankly, Jindon, this is of no help whatsoever. Please explain why you have made the comment. The point about these forums is to support and educate people, not to deride them. We all make mistakes when learning - there is no shame in that. The OP has asked for VBA, not a formula - either help him with his request or do not participate any further in this thread.
    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.

  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,647

    Re: sum if formula works as array but running non-stop as VBA

    Quote Originally Posted by Akbarov View Post
    because customers will use this file, they might delete formula by mistake
    I know you do not wish to use a formula, but please remember that cells containing formulae can be locked and protected to prevent accidental erasure.

  11. #11
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA


  12. #12
    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,647

    Re: sum if formula works as array but running non-stop as VBA

    I have asked you to explain your comment in post #2: please do so.

  13. #13
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    If you read the link, you will understand.

  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,647

    Re: sum if formula works as array but running non-stop as VBA

    Do as you have been asked and explain the comment here, please.

  15. #15
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    Originally
    Please Login or Register  to view this content.
    Now
    Please Login or Register  to view this content.
    Named range for whole column and use in an array formula is ridiculous.

  16. #16
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: sum if formula works as array but running non-stop as VBA

    anyways will use array formula and protect sheet, jindon helped me too, problem is because i am newbie with bad english.

  17. #17
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    You can do like
    Please Login or Register  to view this content.
    So that formula should not remain.

  18. #18
    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,647

    Re: sum if formula works as array but running non-stop as VBA

    Thank you.

  19. #19
    Registered User
    Join Date
    06-21-2017
    Location
    Missouri, USA
    MS-Off Ver
    2007 through 2019
    Posts
    71

    Re: sum if formula works as array but running non-stop as VBA

    It might be taking a long time because your ranges are so large. Try this, it narrows your ranges. If your lists don't start in row 1 you will need to change the 1s to the row your data starts in.
    Please Login or Register  to view this content.

  20. #20
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: sum if formula works as array but running non-stop as VBA

    i tryed your code but i get #N/a result

    when i change match(list4,list3,0) to match(list3,list4,0) i get 125443 which is not correct result

  21. #21
    Registered User
    Join Date
    06-21-2017
    Location
    Missouri, USA
    MS-Off Ver
    2007 through 2019
    Posts
    71

    Re: sum if formula works as array but running non-stop as VBA

    Well, I didn't change the formula because you said that it worked for you as an array. I'm a newbie like you so I don't think I can help further, but on the bright side the code didn't continue to run forever

  22. #22
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    Please Login or Register  to view this content.
    Last edited by jindon; 12-16-2018 at 08:35 AM.

  23. #23
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: sum if formula works as array but running non-stop as VBA

    you want me to add this to old code? or is that single code?

  24. #24
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    replace
    Please Login or Register  to view this content.
    part with the one I posted.

  25. #25
    Forum Contributor
    Join Date
    06-30-2018
    Location
    Azerbaijan
    MS-Off Ver
    Excel 2016
    Posts
    145

    Re: sum if formula works as array but running non-stop as VBA

    Works like a charm... thank you very much

    isn't VBA better for huge files? because i need to use same code for 30 cells , array formula will count all at once but VBA 1by1 ? i change and copy paste your VBA is ok right? for all 30

  26. #26
    Forum Guru
    Join Date
    08-15-2004
    Location
    Tokyo, Japan
    MS-Off Ver
    2013 O.365
    Posts
    22,518

    Re: sum if formula works as array but running non-stop as VBA

    I don't understand what you are trying to do.

  27. #27
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,872

    Re: sum if formula works as array but running non-stop as VBA

    crossposted: https://www.excelforum.com/excel-pro...ost5027643Rule 03: Cross-posting Without Telling Us

    Your post does not comply with Rule 3 of our Forum RULES. Do not cross-post your question on multiple forums without telling us about your threads on other forums.

    Post a link to any other forums where you have asked the same question.

    Cross-posting is when you post the same question in other forums on the web. The last thing you want to do is waste people's time working on an issue you have already resolved elsewhere. We prefer that you not cross-post at all, but if you do (and it's unlikely to go unnoticed), you MUST provide a link (copy the url from the address bar in your browser) to the cross-post.

    Read this to understand why we ask you to do this.

    I have added the crosspost reference for you today. Please comply with this and all our rules in the future
    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

  28. #28
    Administrator 6StringJazzer's Avatar
    Join Date
    01-27-2010
    Location
    Tysons Corner, VA, USA
    MS-Off Ver
    MS365 Family 64-bit
    Posts
    24,720

    Re: sum if formula works as array but running non-stop as VBA

    This is a duplicate post and as such does not comply with Rule 5 of our forum rules. This thread will now be closed, you may continue in your other thread.

    Thread Closed.
    Jeff
    | | |會 |會 |會 |會 | |:| | |會 |會
    Read the rules
    Use code tags to [code]enclose your code![/code]

Closed Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Array formula only works on some cells
    By Whoop92 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 06-21-2017, 07:42 AM
  2. [SOLVED] This Array formula works sometimes and not others
    By sipa in forum Excel Formulas & Functions
    Replies: 1
    Last Post: 04-09-2017, 03:51 PM
  3. code works running in visual basic editor but not when running from Excel macro
    By smporco in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-06-2016, 05:44 PM
  4. 1st Array formula works, but rest does not
    By BuddJ in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-16-2016, 10:33 PM
  5. [SOLVED] Explaining how array formula works
    By Brawnystaff in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 01-23-2016, 05:59 PM
  6. IF array formula almost works.
    By Baalorian in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 03-01-2015, 09:29 PM
  7. Replies: 1
    Last Post: 11-03-2008, 06:23 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