+ Reply to Thread
Results 1 to 13 of 13

SUMPRODUCT last Column

  1. #1
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    391

    SUMPRODUCT last Column

    Hi All,

    I am using sumproducts in VBA and I have below code:

    Please Login or Register  to view this content.
    instead of AI!$AY$2:$AY$366 in above code I want to refer to the last column of sheet AI. How can I change that in above code?

    Thanks,
    Last edited by hanif; 07-22-2016 at 06:54 AM.

  2. #2
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    391

    Re: SUMPRODUCT last Column

    If anyone know any other way please say. I can upload the spreadsheet if helps understanding better.

  3. #3
    Forum Contributor
    Join Date
    04-29-2012
    Location
    nuneaton, England
    MS-Off Ver
    Office 365
    Posts
    372

    Re: SUMPRODUCT last Column

    can you use a named range for the last column ?

  4. #4
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    391

    Re: SUMPRODUCT last Column

    I have defined the last column as "AIlc" and used it as instead of AI!$AY$2:$AY$366 but the return is VALUE or NAME.

    Quote Originally Posted by wayneg View Post
    can you use a named range for the last column ?

  5. #5
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    391

    Re: SUMPRODUCT last Column

    I have defined the last column as "AIlc" and used it as instead of AI!$AY$2:$AY$366 but the return is VALUE or NAME.

    Quote Originally Posted by wayneg View Post
    can you use a named range for the last column ?

  6. #6
    Forum Expert
    Join Date
    04-23-2009
    Location
    Matrouh, Egypt
    MS-Off Ver
    Excel 2013
    Posts
    6,892

    Re: SUMPRODUCT last Column

    Hello Hanif
    Try something like that (Not Tested)
    Please Login or Register  to view this content.
    < ----- Please click the little star * next to add reputation if my post helps you
    Visit Forum : From Here

  7. #7
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    391

    Re: SUMPRODUCT last Column

    Thanks Yasser,

    It does look very sensible. I was thinking the same idea but didn't know how to interprete it into vba. I am getting "Application-defined or object-defined error" message on below line. Any idea how can I fix that?

    Please Login or Register  to view this content.
    Thanks,

    Quote Originally Posted by YasserKhalil View Post
    Hello Hanif
    Try something like that (Not Tested)
    Please Login or Register  to view this content.

  8. #8
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: SUMPRODUCT last Column

    Sure you didn't get the lower case "L" mixed up with the number 1?

    Please Login or Register  to view this content.
    They look alike when written.

  9. #9
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    391

    Re: SUMPRODUCT last Column

    Yes, I have double checked but still getting same error message!

    Quote Originally Posted by JOHN H. DAVIS View Post
    Sure you didn't get the lower case "L" mixed up with the number 1?

    Please Login or Register  to view this content.
    They look alike when written.

  10. #10
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    391

    Re: SUMPRODUCT last Column

    Yes, I have double checked but still getting same error message!

    Quote Originally Posted by JOHN H. DAVIS View Post
    Sure you didn't get the lower case "L" mixed up with the number 1?

    Please Login or Register  to view this content.
    They look alike when written.

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

    Re: SUMPRODUCT last Column

    Please do not quote when you reply! Just reply will do.
    I have tested it and it works.
    Also use Option Explicit with the code to spot out a typo

    Please Login or Register  to view this content.

  12. #12
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: SUMPRODUCT last Column

    That's the only thing I see that would produce that error. What about in your Dim statement?

  13. #13
    Forum Contributor
    Join Date
    11-09-2012
    Location
    United Kingdom
    MS-Off Ver
    Excel 2013
    Posts
    391

    Re: SUMPRODUCT last Column

    I have checked them all, they are all fine. AIlc gives me a value of 166248. Would this could cause the problem?
    Quote Originally Posted by JOHN H. DAVIS View Post
    That's the only thing I see that would produce that error. What about in your Dim statement?

+ 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] Sumproduct and Countif in column A and need to sum quantity in column F
    By drewship in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 01-28-2016, 03:54 PM
  2. Sumproduct within same column
    By lisla in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 05-22-2015, 02:58 AM
  3. Sumproduct of column based on text search of neighbouring column
    By anthropormorph in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 01-01-2015, 10:51 AM
  4. [SOLVED] Sumproduct & Column
    By penexcel in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 05-23-2014, 02:18 PM
  5. [SOLVED] SUMPRODUCT IF COLUMN B=x AND COLUMN E CONTAINED IN A LIST
    By AL1976 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-17-2014, 10:35 AM
  6. SUMPRODUCT - Every other column
    By Jabba in forum Excel General
    Replies: 6
    Last Post: 03-23-2009, 11:56 AM
  7. SUMPRODUCT - If column 'X' Does not contain
    By Badvgood in forum Excel General
    Replies: 1
    Last Post: 02-12-2007, 08:28 AM

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