Need help on VBA code..

yameixtz

New Member
Joined
Oct 3, 2021
Messages
8
Office Version
  1. 2013
Platform
  1. Windows
Hi there. I was wondering if you could help me on this. I'm not good on Macros.

I wanted to group the data from SHEET2 by OFFICES (Column E) so I will be able to sum up their ACTUAL LITERS WITHDRAWN (Column K) per office. Once total liters is summed up by office.. I will be able to deduct the number of liters actually withdrawn of a certain office from SHEET2 to that summary in SHEET1 under LITERS WITHDRAWN (Column D). Then automatically it will deduct from (Column C) ALLOCATED LITERS and output on (Column E) under BALANCE LITERS.

I attached my test excel file for you to get a glimpse on.

It would mean a lot if you could help me on this guys. Hope to hear from you soon. Thank you. Keep safe everyone. :)
 

Attachments

  • sheet1.png
    sheet1.png
    113.9 KB · Views: 9
  • sheet2.png
    sheet2.png
    152.9 KB · Views: 8

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Welcome to MrExcel Message Board.
1. Please upload example file & Desired Result with description below of my post.
2. you want VBA, What about formula:
For Example if your data start form row 2 at sheet1, then you can write at D2 this formula and Drag it down:
Excel Formula:
=SUMIFS(Sheet2!$K$2:$K$200,Sheet2!$E$2:$E$200,A2)
 
Upvote 0
The data on SHEET2 will be adding data from time to time.. and of different offices. See the sample EXCEL file uploaded.. I'm hoping every time a data is added.. and depending from what office.. LITERS WITHDRAWN and BALANCE LITERS will automatically deduct from the ALLOCATED LITERS from SHEET1.
 
Upvote 0
@maabadi unless I am misreading it I think we need to throw Fuel Type into the criteria.

Formula for D32.
Excel Formula:
=SUMIFS(Sheet2!$K$2:$K$1000,Sheet2!$E$2:$E$1000,A32,Sheet2!$I$2:$I1000,B32)
 
Upvote 0
I'm new here.. Can I upload my EXCEL file here along with my post so you can get a glimpse of it?
 
Upvote 0
Can I upload my EXCEL file here along with my post so you can get a glimpse of it?
Yes. This is my description below of my Post.
please upload example with XL2BB add-in (Preferable) OR upload at free hosting site e.g. GoogleDrive, OneDrive, Dropbox and Insert Link at post.

What about Formula?
 
Upvote 0
Yes. This is my description below of my Post.
please upload example with XL2BB add-in (Preferable) OR upload at free hosting site e.g. GoogleDrive, OneDrive, Dropbox and Insert Link at post.

What about Formula?
link to my test-file.

 
Upvote 0
Yes. This is my description below of my Post.
please upload example with XL2BB add-in (Preferable) OR upload at free hosting site e.g. GoogleDrive, OneDrive, Dropbox and Insert Link at post.

What about Formula?
Macro or a Formula it won't matter as long as I get my desired output and automatically. Like every time an office data is added to Sheet1.. Sheet2 will automatically be updated of the office's BALANCED LITERS.
 
Upvote 0
Macro or a Formula it won't matter as long as I get my desired output and automatically. Like every time an office data is added to Sheet1.. Sheet2 will automatically be updated of the office's BALANCED LITERS.

Then Use @Alex Blakenburg formula at Post #4 and drag it down.

Also if you can access to me to edit your uploaded file, I can add formula to that.
 
Upvote 0

Forum statistics

Threads
1,214,864
Messages
6,121,986
Members
449,058
Latest member
oculus

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top