Hi there,
I would like help creating a macro that can perform a task similar to sumifs function.
I have a workbook with multiple tabs. The first tab is the "Main" tab and there are three tabs following labelled "USD", "EUR" and "GBP".
I want to update the three currency tabs by using the name of the tab as reference, i.e. looking up "USD" in the main tab and summing.
Using the USD tab as my illustration; this is how the sheet is set up:
The "Main" tab contains information for each column above. For ID 100, there are multiple line items and the currencies vary. I would therefore like a macro that will look for ID 100 in column E of Main tab, "Purchase" in column J, the tab name which in this case is "USD" in column M and calculate the sum based on these criteria using the amounts in column N.
For the refund column it will be similar to the above but instead of looking up "Purchase" in column J I need to look up "Refund" for every ID 100 that is in USD.
For the Purchase Fee and Refund Fee columns, it gets a bit more complicated. I need to sum columns O, P, Q, R & S in "Main" tab where "Purchase" is contained in column J, "USD" in column M and ID 100 in column E. And similarly for the Refund Fee column instead of "Purchase" I need to look up "Refund".
The Net Amount is a summation of the four preceding columns.
Can this be done in VBA?
I would like help creating a macro that can perform a task similar to sumifs function.
I have a workbook with multiple tabs. The first tab is the "Main" tab and there are three tabs following labelled "USD", "EUR" and "GBP".
I want to update the three currency tabs by using the name of the tab as reference, i.e. looking up "USD" in the main tab and summing.
Using the USD tab as my illustration; this is how the sheet is set up:
ID | Purchase | Refund | Purchase Fee | Refund Fee | Net Amount |
100 | =Purchase+Refund+Fees | ||||
101 | |||||
102 |
The "Main" tab contains information for each column above. For ID 100, there are multiple line items and the currencies vary. I would therefore like a macro that will look for ID 100 in column E of Main tab, "Purchase" in column J, the tab name which in this case is "USD" in column M and calculate the sum based on these criteria using the amounts in column N.
For the refund column it will be similar to the above but instead of looking up "Purchase" in column J I need to look up "Refund" for every ID 100 that is in USD.
For the Purchase Fee and Refund Fee columns, it gets a bit more complicated. I need to sum columns O, P, Q, R & S in "Main" tab where "Purchase" is contained in column J, "USD" in column M and ID 100 in column E. And similarly for the Refund Fee column instead of "Purchase" I need to look up "Refund".
The Net Amount is a summation of the four preceding columns.
Can this be done in VBA?