VBA Data table columns 1 and 2 determine value in 2 different cells outside the table.

JulianvO

New Member
Joined
Sep 9, 2022
Messages
29
Office Version
  1. 2021
Platform
  1. Windows
Greetings

I have a data table - "Gas". I need to show in cell E3 how many gas cylinders are full and in cell F3 how many are empty.
If Date in Use and Date Empty have values - Dates - then cell F5 must show 1. If only Date in Use has a value - Date - then Cell E3 will show 1.

Can someone assist me with VBA code?

Thanks Julian

Screenshot 2024-06-06 212351.png
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Why do you need VBA, if given the logic you suggest would something like this work...

Book1
ABCDEFG
1
2Date In UseDate EmptyQty FullQty Empty
34/5/20245/8/202411
45/8/2024
5
6
7
8
9
10
11
12
13
14
Sheet1
Cell Formulas
RangeFormula
E3E3=COUNTA(Gas[Date In Use])-COUNTA(Gas[Date Empty])
F3F3=COUNTA(Gas[Date Empty])
 
Upvote 0
Solution
Why do you need VBA, if given the logic you suggest would something like this work...

Book1
ABCDEFG
1
2Date In UseDate EmptyQty FullQty Empty
34/5/20245/8/202411
45/8/2024
5
6
7
8
9
10
11
12
13
14
Sheet1
Cell Formulas
RangeFormula
E3E3=COUNTA(Gas[Date In Use])-COUNTA(Gas[Date Empty])
F3F3=COUNTA(Gas[Date Empty])

Thank you Igold.

Appreciate the help
 
Upvote 0
You're welcome, I was happy to help. Thanks for the feedback!
 
Upvote 0

Forum statistics

Threads
1,221,846
Messages
6,162,378
Members
451,760
Latest member
samue Thon Ajaladin

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