Conditional macro in Excel based on two or more conditions please help

Jyotirmaya

Board Regular
Joined
Dec 2, 2015
Messages
204
Office Version
  1. 2019
Platform
  1. Windows
I have 3 sheets
Sheet1 name - Demand
Sheet2 name - Collection
Sheet3 Name - Balance

Demand means A user is having some Due for a particular product
Collection means the amount collected from that person for that product
Balance means the person is due the rest amount i.e Balance = Demand - Collection

There are some persons also there who paid the amount more than due and those amount were kept reserved in the Column Excess Unadjusted amount in the Balance sheet.

There are persons who paid less than the demand amount are stored in the Balance sheet after deducting the Demand from that person- collection from that person.

There are some rules to be followed while getting the Balance amount results are

1.If there is a demand in User ID and collection is done same as per the demand amount and unadjusted amount is also there, then no changes in unadjusted amount, balance will be zero.

Example If there is a demand in Sheet in A1 is 5 collection is 5 inA1 and in balance sheet D2 Unadjusted amount is 10 then no changes in the unadjusted amount balance will be zero. i.e in Balance sheet B2-B3 = 0

2.If there is a demand in User ID and collection is done more than demand then that, then the excess amount will be added to excess unadjusted column.

Example If there is a demand in Sheet in A1 is 5 and collection is Rs 10 in A1 then Rs 5 will be shown as collection B3 in Balance sheet and Extra Rs 5 collected will be shown as Excess unadjusted column in D2 i.e in Balance sheet B2-B3=0

3. If there is a demand in current year of a User and collection is not there for that current year and if Excess unadjusted amount is available then that amount will be adjusted according to the demand amount, the adjusted amount should show in a new column and the rest unadjusted amount will be keep reserved after deduction of demand amount.

Example If Demand Sheet in A1 is 5 collection sheet is 0 of A1 and in balance sheet D2 unadjusted amount available 10 then Rs5 will be Adjusted and Rs 5 will be shown on C2 of Balance sheet as Adjusted amount i.e in Balance sheet B2-C2 = 0 & D2 will be 5

I want a macro to fulfill all such conditions.
excess_condition.jpg
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)

Forum statistics

Threads
1,215,584
Messages
6,125,666
Members
449,248
Latest member
wayneho98

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