Forum Discussion
goncalogera
Nov 13, 2020Copper Contributor
Create a custom SUM(IF) function with VBA
Hi there, I have a table called ("Vendas2020") that has the daily sales and each row has either "C" or "V" if they're either a purchase or a sale (C/V column is the fifth one and is called "Compra...
- Nov 13, 2020
If I understand what you're trying to do (conditional subtotal), then I don't think you don't need vba.
I attached an example file - if you filter column 1 for either "A" or "B", then the formula below the table will subtotal the visible cells where Compra/Venda=C.
JMB17
Nov 13, 2020Bronze Contributor
If I understand what you're trying to do (conditional subtotal), then I don't think you don't need vba.
I attached an example file - if you filter column 1 for either "A" or "B", then the formula below the table will subtotal the visible cells where Compra/Venda=C.
goncalogera
Nov 13, 2020Copper Contributor
JMB17Thank you very much for all your work! I don't know if my line of thought is correct but can the subtotal function perform "multiple ifs"?
- JMB17Nov 13, 2020Bronze ContributorThe subtotal function isn't testing any conditions, it's just one of two arguments for the sumproduct function, which can perform multiple "ifs."
But, the exact syntax will depend on whether you're talking about testing multiple columns for a single value, or testing a single column for multiple values.- goncalogeraNov 13, 2020Copper Contributor
JMB17 Got it, I'll try it then! Thanks again for your help!