Extracting data from excel table if it is between two given dates and then adding the numbers using VBA code

  • I have a table in excel having eight columns which includes year, date of deposit and total fees. Now, if date of deposit is between two given dates and it pertains to year 2019-20 then I am trying to extract value from corresponding fee column. I am trying to get total fees deposited between two given dates for a particular year. But i am not getting desired result. Kindly help. I am using If and else statement and For each loop.



  • Ashish, the loop which you are using has an inner loop which makes it difficult to achieve what you desire, because for each statement runs at first and not correspondingly with another for each statement, hence you need to use do while loop statement.


Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!