+ Reply to Thread
Results 1 to 6 of 6

Using last row in a VBA SUMIFS formula

  1. #1
    Registered User
    Join Date
    02-04-2018
    Location
    Canberra, Australia
    MS-Off Ver
    2013
    Posts
    74

    Using last row in a VBA SUMIFS formula

    Hi All,

    I am using the below code to identify the last used row and then want to use it in the SUMIFS formula, however any attempts to use it to identify the range for the formula isn't working

    Please Login or Register  to view this content.

    My last attempt is in the first formula.


    Please Login or Register  to view this content.
    any help is appreciated

  2. #2
    Forum Moderator
    Join Date
    01-21-2014
    Location
    St. Joseph, Illinois U.S.A.
    MS-Off Ver
    Office 365 v 2403
    Posts
    13,406

    Re: Using last row in a VBA SUMIFS formula

    Do you prefer VBA?

    This sounds like something that can be easily done with formula.
    Hard to tell without a representative sample of what you are working with and what you aim to accomplish.

    If you are not familiar with how to upload a sample Excel file:

    To attach a file to your post: (Please no pics or screenshots ... saves retyping data.),

    be sure to desensitize the data
    • click “Go Advanced” (next to Post Quick Reply – bottom right),
    • scroll down until you see “Manage Attachments”, click that,
    • click “Browse”.
    • select your file(s)
    • click “Upload”
    • click “Close window”
    • click “Submit Reply”
    The file name will appear at the bottom of your reply.
    Dave

  3. #3
    Registered User
    Join Date
    02-04-2018
    Location
    Canberra, Australia
    MS-Off Ver
    2013
    Posts
    74

    Re: Using last row in a VBA SUMIFS formula

    Thanks Dave,

    I'm using VBA to add the formulas and then copy and paste as values to remove the formulas - this saves the spreadsheet re calculating each formula every time something changes (ie no formulas left in the spreadsheet)

    I have five worksheets that each have a different 'last row' and currently contains between 104,456 and 149,116 rows each with new data being added daily.

    Instead of using $A:$A, $B:$B etc in the formula I want to use

    $A2:A & LRow - which would resemble $A2:$A104456

    so lRow automatically changes to the last row, after new daily data is added, in the hope that it will speed up the calculations.

    Unfortunately due to departmental IT restrictions I cannot attach a copy of the spreadsheet as the macros will be disabled.

    Hope this makes a little more sense on what I'm trying to achieve.

    Chnag the code from this

    Please Login or Register  to view this content.

    to this


    Please Login or Register  to view this content.
    Cheers

    Dean
    Last edited by DeanMcK; 01-01-2019 at 09:23 PM.

  4. #4
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Using last row in a VBA SUMIFS formula

    You need to do it like below...

    "=SUMIFS(AAA!$F2:$F" & lRow & ",AAA!$A2:$A" & lRow & ",Graphs!$G$1,AAA!$B2:$B" & lRow & ",'Graph data'!A" & I + 3 & ")"
    Regards
    sktneer


    Treat people the way you want to be treated. Talk to people the way you want to be talked to.
    Respect is earned NOT given.

  5. #5
    Registered User
    Join Date
    02-04-2018
    Location
    Canberra, Australia
    MS-Off Ver
    2013
    Posts
    74

    Re: Using last row in a VBA SUMIFS formula

    Thanks sktneer,

    Works a treat now - thought I had tried it with the "" marks - but must have had something else wrong.

    Cheers

    Dean

  6. #6
    Forum Guru sktneer's Avatar
    Join Date
    04-30-2011
    Location
    Kanpur, India
    MS-Off Ver
    Office 365
    Posts
    9,649

    Re: Using last row in a VBA SUMIFS formula

    You're welcome Dean! Glad it worked as desired.

    Happy New Year!

+ 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. Replies: 0
    Last Post: 08-22-2017, 03:49 PM
  2. [SOLVED] Sumifs formula without using sumifs....
    By blockbyblock in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 07-10-2017, 10:45 AM
  3. Replies: 3
    Last Post: 01-24-2017, 08:08 AM
  4. Replies: 10
    Last Post: 12-16-2015, 03:16 PM
  5. [SOLVED] Sumifs formula giving #value even though each part individually works as a sum formula
    By carrach in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 01-08-2015, 10:34 AM
  6. Replies: 2
    Last Post: 05-22-2014, 04:14 AM
  7. [SOLVED] Sumifs, problem with the formula: =sumifs(c10:c200,<=today(),0)
    By Faustocruz in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 10-08-2012, 04:26 AM

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