Excel VBA Code for Min(SumIf() - SumIf())

Wetaka - Sep 3, 2018 at 11:09 AM - Latest reply: TrowaD 2433 Posts Sunday September 12, 2010Registration dateModeratorStatus September 17, 2018 Last seen
- Sep 4, 2018 at 11:36 AM
Dear Members of CCM Forum,

I thank you all for your great and tireless effort to help the world.
I have been using the excel formula: =MIN(SUMIF(D:D,D3,F:F)-SUMIF(D$1:D2,D3,I$1:I2),E3) for some some time to calculate the total quantity of an item issued out of stock and as data increases in volume I notice that the computer slows down and therefore request for your help to create a VBA code to use so that it returns a value when entering data in the next empty row.

My excel table for data entry has headings as follows
Column D: Item Name
E: Quantity Received
F: Quantity Issued
G: Unit Cost
H: Value of Quatity Received ie, E * G
I: is Headed "Total Quantity out" of the Item in D

I am not a programmer but when tried to write the following code , before I could move to the next line a message box appeared with the following error notification;

Compile error
Expected: List separator or )

Cells(eRow, 9).Value = WorksheetFunction.Min(SumIf(Columns(4),ComboBox2.Value,Columns(6))-WorksheetFunction.SumIf(sum(D$1:D).Value,ComboBox2.value,Sum(I$1:I),Columns(5))))

I Will be very grateful for every effort towards creating this code.

Thank you in Advance.

Wetaka
See more 

Your reply

1 reply

TrowaD 2433 Posts Sunday September 12, 2010Registration dateModeratorStatus September 17, 2018 Last seen - Sep 4, 2018 at 11:36 AM
0
Thank you
Hi Wetaka,

I notice that you have 8x "(" and 9x ")". Remove the last ")" and see if that works.

Best regards,
Trowa
Respond to TrowaD