+ Reply to Thread
Results 1 to 2 of 2

macro for sumif formula

  1. #1
    supamari0
    Guest

    macro for sumif formula

    I currently have an excel document that uses the sumif formula. Currently, it
    checks column E for a specific word (in this case "Hydrogen") It then takes
    all the rows with "hydrogen" and adds up the numbers in the N column for
    those respective rows.

    My problem is that I need to turn this process into a macro rather than
    relying on a formula. Any direction on how to code this? I know it should be
    fairly simple but I'm a VBA novice.

    Thanks in advance!


  2. #2
    Toppers
    Guest

    RE: macro for sumif formula

    Sub MySumif()
    Range("A1") = Application.SumIf(Range("E:E"), "Hydrogen", Range("N:N"))
    End mySumif

    You could change "Hydrogen" to reference a cell e.g. X1

    Range("A1") = Application.SumIf(Range("E:E"), Range("X1"),Range("N:N"))

    HTH

    "supamari0" wrote:

    > I currently have an excel document that uses the sumif formula. Currently, it
    > checks column E for a specific word (in this case "Hydrogen") It then takes
    > all the rows with "hydrogen" and adds up the numbers in the N column for
    > those respective rows.
    >
    > My problem is that I need to turn this process into a macro rather than
    > relying on a formula. Any direction on how to code this? I know it should be
    > fairly simple but I'm a VBA novice.
    >
    > Thanks in advance!
    >


+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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