VBA code to return the most recent data

lgetach

New Member
Joined
May 28, 2014
Messages
6
Hi,

I had posted a question for an If formula but i am thinking there might be a way of fixing my issue through VBA?

This is my problem :

I have a worksheet that will be constantly updated.

In D53:CU54 i currently have an IF formula which looks at newly Inserted data in D100:DH101 (Via VBA button) and updates the data in D53:CU54 to the most recent data inputted in D100:DH101. If there is a blank, i have it returning the sum of data from a table found above in D50,D26,D14 the current formula looks like this:

=IF(D$100=0,SUM(D50,D26,D14),D$101)

The worksheet is constantly updated with new information. the new information is inserted into the D100:DH101 so that is where the most current data is found the data that is replaced by this range will then be found in D102:DH103 and the data from before that is in D104:DH105 and so on (older data will move down as new data is added in).

The formula or Code i would like would do the above, but in the case that there is a 0 inputted into any cell D100:DH101, the cell would pick up the most recent data.

Ie: for D53, it would look at D100, if there is data, it would pick it up, if it is blank, it would look at D102, then D104 etc. until a number is found. if a number is NOT found, it would return SUM(D50,D26,D14).

i know that i can do this with the IF function but the issue is that i don't have a specified amount of inserted data. since the amount of updates cannot be predetermined, i am unable to extend my if formula to include all possibilities.

if this seems outrageous, is there a better, easier way of getting this done? i am open to and welcome all suggestions. I hope someone can help me.

let me know if you have any questions.
Thanks in advance.
 

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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