How to use sumif function in VBA

Поделиться
HTML-код
  • Опубликовано: 21 окт 2024
  • How to use the SUMIF function in VBA. The SUMIF function is useful in inventory management systems, for example. We also show a looping process to automate the SUMIF function.
    Details are available at this link:
    www.exceltraini...

Комментарии • 51

  • @MohAboAbdo
    @MohAboAbdo 2 года назад

    Thank you very much, my dear teacher, for the knowledge you enlighten us. All your lessons are very interesting and very useful.

  • @saichowdarysaripudi840
    @saichowdarysaripudi840 2 года назад

    hii sir this is sai saripudi your voice is clarity and very understandable
    thank you sir thank you so much

  • @MegaBlockface
    @MegaBlockface 4 года назад

    I find your videos and teaching style helpful. Hoping to use this to SUMIF on a single criteria in a single row (PO number) and do so on a dynamic range with unknown number of unique values. I could not find such tutorial of similar example searching your page. I will try to figure out on my own for now, if you have already posted something on your channel that you recall let me know. I just wanted to let you know what I have mentioned that these videos are helpful and concise. Thank you very much.

    • @Exceltrainingvideos
      @Exceltrainingvideos  4 года назад

      Sounds great! Use the concept of the lastrow:
      lastrow = Application.WorksheetFunction.CountA(Range("A:A"))

  • @manojkumar-qd8cn
    @manojkumar-qd8cn 5 лет назад +1

    Explained very well👍

  • @keamlay4021
    @keamlay4021 Год назад

    Dear Sir, I want to see how to format cell that have text length >25 characters (by Excel VBA codes)

  • @guillymoreno486
    @guillymoreno486 7 лет назад

    sir very nice tutorial it gave me additional knowledge in excel vba

  • @reeteshism
    @reeteshism 4 года назад

    Very useful video 👍🏼.
    Just wanted to ask have you made a video wherein you have shown how to use "SUMPRODUCT ()" in vba??
    If yes then please share the link.
    Thanks

  • @guillymoreno486
    @guillymoreno486 7 лет назад

    sir im just curious it is possible to store data in listbox userform and save those data in a listbox for future references. i mean even the form are being closed the data will still save or stored in the listbox when you open it again

  • @pramodchavan9686
    @pramodchavan9686 3 года назад

    thanks sir. i want to do the same with the sumif function to another sheet with dynamic range.

  • @guillymoreno486
    @guillymoreno486 7 лет назад

    hope fully sir u can share me your knowledge thank u and more power sir

  • @nguyenthithuhang8358
    @nguyenthithuhang8358 5 лет назад

    Excuse me Sir, If we have more than 3 items, 100 items for example. They are already put in column D. Then how can we calculate the value in column E in vba? We can't retype the code for 100 times, you know. Thank you so much!

  • @tommystokes2559
    @tommystokes2559 5 лет назад

    I am getting a Compile Error. What am I doing wrong?
    (My sheet is listed as sheet2 & I only completed the function with "A" "B")
    (Compile error says "i" is not defined)
    Sub Loopingsumiffunction()
    Dim a As Long, b As Long
    Dim lastrow As Long
    a = 0
    b = 0
    lastrow = Sheet2.Cells(Rows.Count, 1).End(xlUp).Row
    For i = 2 To lastrow
    If Cells(i, 1) = "A" Then
    a = Cells(i, 2) + a
    ElseIf Cells(i, 1) = "B" Then
    b = Cells(i, 2) + b
    End If
    Next i
    Range("K2") = a
    Range("K3") = b
    End Sub

    • @Exceltrainingvideos
      @Exceltrainingvideos  5 лет назад

      Your code works fine. Your active sheet should be Sheet2. Why are you initializing a,b to 0 and then making no changes at all!

  • @AnveshReddyRampage
    @AnveshReddyRampage 4 года назад

    Hi sir, this was very informational and helpful. I have query, what if we have lots of unique items (more than 300). Is there another way instead of adding all those item names to the code.

  • @kengamarra
    @kengamarra 4 года назад

    Totally useful, thanks a lot!

  • @JosephArouna
    @JosephArouna 7 лет назад

    Hello ! I am in trouble and I come to ask for your help. I am responsible for the human resources of a church hospital with about twenty employees. I would like to automate the definition of salaries scaled according to the classification of each employee (see the Excel table attached). I would like to do it with an Excel (IF) function but I can not do it. could you help me ? Joseph

  • @abinezer81
    @abinezer81 7 лет назад +1

    Sir what if there is a blank in between in column 1? will the code return the blank cell as lat row?

    • @Exceltrainingvideos
      @Exceltrainingvideos  7 лет назад

      Use this code to declare the last column:
      Dim lastColumn As Long
      lastColumn = Cells.Find(What:=”*”, _
      After:=Range(“A1”), _
      LookAt:=xlPart, _
      LookIn:=xlFormulas, _
      SearchOrder:=xlByColumns, _
      SearchDirection:=xlPrevious, _
      MatchCase:=False).Column
      www.exceltrainingvideos.com/tag/find-last-row-column-in-data-with-blanks/
      You may also search my RUclips channel: goo.gl/5Jx1NP

  • @BachXuanHien
    @BachXuanHien 9 лет назад

    Hi you, i am in VietNam. I have a problem is:
    I want copy a range, and paste any range optional. example:
    i have range("A1:B5"), i want make in inputbox is a number optional, after i will paste withis number in this inputbox

  • @athumanjuma2772
    @athumanjuma2772 5 лет назад

    Kindly help if there is a looping VBA , i have more than 20 items in the row i.e a,b,c,d,e, ...up to 20 items

    • @Exceltrainingvideos
      @Exceltrainingvideos  5 лет назад

      This link will help: www.exceltrainingvideos.com/loops-for-next-excel-vba/
      Or search www.exceltrainingvideos.com or my RUclips channel.

  • @nguyenthithuhang8358
    @nguyenthithuhang8358 5 лет назад

    it is really useful. Thank you!

  • @moganadhassramanujaly8555
    @moganadhassramanujaly8555 7 лет назад

    Thank You for the sumif function in VBA video. It works well. I want to do the same with the sumifs function and I am having problems.can you please help me with converting the sumifs into VBA

    • @Exceltrainingvideos
      @Exceltrainingvideos  7 лет назад

      Problems like? Why don't you perform the actions of 'sumifs' and record the macro to get an idea?

  • @jackpun3024
    @jackpun3024 9 лет назад

    Useful. Thanks for the video.

  • @AbdullaKhizamworld
    @AbdullaKhizamworld 2 года назад

    How to use the Sumifs on Loop for Lots of Data Table.

    • @Exceltrainingvideos
      @Exceltrainingvideos  2 года назад

      These Excel VBA tutorials will guide:
      www.exceltrainingvideos.com/tag/how-to-avoid-duplicate-entries-using-countif-in-vba/
      www.exceltrainingvideos.com/add-data-to-excel-database-with-userform-using-countif-function/
      www.exceltrainingvideos.com/how-to-use-sumif-in-vba/
      www.exceltrainingvideos.com/a-super-simple-inventory-automation-system/

  • @NirmalSingh53
    @NirmalSingh53 6 лет назад

    etting a error message”expected list separator” in the following line:
    Range(“H2”) = Application.WorksheetFunction.SumIf(Range(“A2:B8”), “A”, Range(“B2:B8”))
    I would be thankful if you let me know the solution.

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 лет назад

      You'll get this error if you copy and paste from the website. The quotes change and give this error.
      Sub sumifFunction()
      Range("G2") = "A"
      Range("H2") = Application.WorksheetFunction.SumIf(Range("A2:B8"), "A", Range("B2:B8"))
      End Sub

  • @rakeshbond009
    @rakeshbond009 6 лет назад

    I have my data date wise and i want to add the amount if date is current/today(). please advise

    • @rakeshbond009
      @rakeshbond009 6 лет назад

      I have my data date wise and i want to total the amount if date is current/today(). please advise

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 лет назад

      1. Declare a 'total' variable.
      2. In a looping process use a condition to match the date
      3. Add present total to total
      4. Place total value in a relevant cell.
      This link will guide: www.exceltrainingvideos.com/sample-project-in-vba/

  • @abinezer81
    @abinezer81 6 лет назад

    Sir how can i achieve Sumproduct if similarly in vba? Please help

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 лет назад

      This link should help: ruclips.net/video/h2_0zhhRWgM/видео.html

  • @shivarajullagaddi994
    @shivarajullagaddi994 6 лет назад

    Sir how it work different sheet
    It means how to sumif sheet 2 to sheet 1 plz update sir

    • @Exceltrainingvideos
      @Exceltrainingvideos  6 лет назад

      This link will help: www.exceltrainingvideos.com/how-to-use-sumif-in-vba/
      Making an effort on your own to search for this link would have given you more satisfaction.

  • @juls6152
    @juls6152 6 лет назад

    Oh yesit worked! Thank you

  • @Stavros6779
    @Stavros6779 2 года назад

    Very good

  • @kashankhan3137
    @kashankhan3137 4 года назад

    how to use following formula in excel vba
    =SUM(SUMIFS(Sheet2!C:C,Sheet2!A:A,Sheet1!D4,Sheet2!D:D,Sheet1!F3))

  • @roshanmatooreah5064
    @roshanmatooreah5064 6 лет назад

    top net