Wednesday, May 25, 2022
Sunday, May 8, 2022
Indian_Unicorns_by_2025
Thursday, September 2, 2021
CSR Reporting I Using Excel SUMPRODUCT
Example of SUMPRODUCT function in Excel used for an example from Social Sector.
Let us assume, that as a funding company your donations for a month are as per the table given below.
Amount in Rupees | Description |
25,000 | Covid Relief - PPE kits |
10,000 | Covid Relief - Grocery kit |
40,000 | Covid Relief - Grocery kit |
20,000 | General Donation for healthcare activities |
44,000 | Medical Assistance |
3,50,000 | Covid relief activities |
10,000 | General donation |
6,000 | Monthly aid |
89,600 | 50% advance for supply of medicines |
5,00,000 | Covid relief activities |
4,980 | Supply of groceries to tribal children |
5,00,000 | Relief activities for Covid |
49,450 | Scholarship |
22,166 | Scholarship |
Your manager wants to know the spend on covid relief related activities for that particular month.
Now let us find out how SUMPRODUCT function can do the conditional sum. The Excel SUMPRODUCT function multiplies ranges or arrays together and returns the sum of products.
The expression to use is =SUMPRODUCT(Table1[Amount]*--(ISNUMBER((SEARCH("covid",Table1[Purpose],1))))). Where the dataset has a name of Table1.
If the term covid is found, the search function returns a number indicating its position. ISNUMBER function then would return True. The double negative forces True and False to 1 and 0 for doing the multiplication. Then the addition.
=SUMPRODUCT(Table1[Amount]*(ISNUMBER((SEARCH("COVID",Table1[Purpose],1))))) is similar to the above formula.
Thus, to recap, wherever the word covid is found, the function returns “True”, and the corresponding amount is multiplied by 1. All such amounts are added. The search term “covid” is not case sensitive. You can use “COVID” as well. The answer is Rs 14,25,000.
Similarly formula =SUMPRODUCT(Table1[Amount]*--(ISNUMBER((SEARCH("Scholarship",Table1[Purpose],1))))) can be used to calculate donations given as Scholarships. The answer is Rs 71,616.
In my next blog, I will add another dimension of time to calculate the conditional sum.
13:26 01-09-2021
***
Wednesday, January 29, 2020
Excel Power Query - One to many and other way round
I had a list of unicorns downloaded from internet as shown below. The Cat1 is categories column.
Figure 1
So, for every unicorn (Company), you have one or many select investors.
Step 1:
Using power query in Excel 2016, I filtered the list to show Indian unicorns (16 of them). This was a fairly simple operation.
Step 2:
Then again using power query I transformed the column containing select investors (many in one cell) in to multiple rows. I got a list of every Indian unicorn against the every select investor. The total number of rows grew to become 46.
Step 3:
Further I grouped all unicorn companies on select investors to know all the Indian unicorns they have invested. But for that I had to write a small custom function to combine all the unicorns as one list against every investor from select investor column. Then the list was put in column named Custom. Now we know each investor and Indian unicorns it is investing in as shown below.
Figure 2
So, to conclude from unicorn company with its multiple investing firms; we now have investing firm and multiple unicorns companies it is investing in.
This kind of requirement comes often with different contexts. I am new to power query and finding its usefulness as I could do the above in minutes. Next I want to do similar output using python.