Consulting

Results 1 to 4 of 4

Thread: conditional adding through sheets in a loop. Novice.

  1. #1

    conditional adding through sheets in a loop. Novice.

    Hi
    Total Excel progamming novice here.
    Boss summoned me to do a quick programming.

    In an excel sheet he has got 5 worksheets with a list of medicines and quantity of drugs in the 5 pharmacy branches. The medicines are not in order in the sheets.

    Basically I have to write a code to add the quantities of each drug and make a separate column in another excel file.



    If I had the time I would read a lot about it, but now I need a quick fix please.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    Why does your boss give this job to a novice. Is he dumb?

    Use a formula

    =SUMIF(Sheet2!A:A,"medicine 1",B:B)+SUMIF(Sheet3!A:A,"medicine 1",B:B)+ etc.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Well I am a entry level programmer here, but have used excel only for basic data functions.

    Thanks for the code.

    I stick that SUMIF in a loop don't I, in which case syntax for loop please

  4. #4
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    No, it is a worksheet function so you stick it on the summary worksheet. One set of SUMIFs for each medicine. Smart money would say create a list of medicines and refer to these in the SUMIF formulae.
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •