PDA

View Full Version : conditional adding through sheets in a loop. Novice.



av_raje
06-16-2008, 07:18 AM
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.

:help

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

Bob Phillips
06-16-2008, 07:36 AM
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.

av_raje
06-16-2008, 08:03 AM
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 :)

Bob Phillips
06-16-2008, 08:58 AM
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.