I am making a financial spread sheet for work but I have six categories for different options. I want to be able to put an X in a category and excel automatically be adding my totals. The numbers are set in the categories butthe situation changes.
I've had a stab in the dark at a solution for you, see below the numbers represent the category's and the 0 is the cell the formula is in (G2).
If there is an X directly below the category, then the formula adds up the total of the column the X is in, and removes the category number from the total.
=IF(A3="X",SUM(A:A)-A2,IF(B3="X",SUM(B:B)-B2,IF(C3="X",SUM(C:C)-C2,IF(D3="X",SUM(D:D)
-D2,IF(E3="X",SUM(E:E)-E2,IF(F3="X",SUM(F:F)-F2,IF(G3="X",SUM(G:G)-G2,"")))))))
Is this any help?
Related
I have some irregular data (e.g. I have 5 groups of data, each group occupies different amount of rows) and I am wondering if there is a way to use Python to add subtotal to all of my spreadsheets, breaking at each group change.
Since row amount is irregular for each group, I tried inserting empty row at each change and adding a subtotal. However, I am unable to do a sum for each change or a grand total without using hard code (specify on the row number, which changes for every spreadsheet).
Thanks in advance.
Edit: Added code I am working on
for num in range (8, ws.max_row+1):
if ws['E'+str(num)].value == ws['L1'].value:
ws['L'+str(num)]='=SUMIF($A$'+str(ws[num])+':$A$'+str(ws[ws.max_row])+',LEFT(A'+str(ws[num])+',6),$E$'+str(ws[num])+':$E$'+str(ws[ws.max_row])+')'
num+=1
Can you add a column to each list that can help you categorize them? that way you can do a =SUMIF based on the categorized names. here's a code snipit and an image to reference:
=SUMIF(B:B,B15,C:C)
the formula calculates the left table (dogs).
as you can see the totals wont be added if the category is mentioned. also, all three tables are irregular so it will add up regardless of length.
I need to create a module that will count the amount of values in specified date ranges, with other criteria.
For example, I have a list of products (Products A, B , C, D) in column C, and their sale date in column G.
I need to count all of product A sold before 1/1/1998. I then need to calculate product A sold between 1/1/1998 and 1/1/2005 etc.
I need to be able to run this for all the types of products, and group products together.
E.g. count all of product A & B sold before 1/1/1998.
This has to be done for a new workbook on a weekly basis so ideally needs to be able to be run for a new workbook each week. The tab names always remain the same.
Any help on how to get started would be appreciated
This answer will assume that your dates are entered as excel dates in column G and not a text. You can test this by using the formula =ISNUMBER(G3) where G3 is one of your dates. If it returns true, then your date is properly stored for use by excel formulas and this answer.
=SUMPRODUCT((($C$1:$C$100="A")+($C$1:$C$100="B"))*($G$1:$G$100<Date(1998,1,1))
That is how to hard code it. Personally I would build a table. Each row of the table would be a product you are interested in knowing the count for and a sum of the count would give you combined totals. Repeat the table if you need multiple combinations.
In the following example a single product was counted and then the total for all products listed was the total. The formula for the example in L3 and copied down for each product was:
=SUMPRODUCT(($C$2:$C$9=$J4)*($G$2:$G$9<K4))
The total at the bottom of the table was a simple SUM formula. Because SUMPRODUCT performs array like operations, avoid using full column references and try to restrict it to the data that needs to be checked. Otherwise you may notice a slow down in your system as multiple excess calculations are being perfomed.
I'm working on a visualization in Tableau, regarding numbers for actual figures, budgets, and estimates. For budget and estimate, I also want to show the percentage of difference compared to the actual. I have these numbers for several categories.
I recreated an example as below.
What I now want is: Hide the percentage calculation ONLY for the actuals column.
I tried several things. but it always ends in multiple columns being deleted. How can I do this?
(Percentages are calculated across table and based on "actual" scenario).
Edit 1: As in one of the answers, creating seperate calculated fields for each value is an option. But in my problem, I will have a lot of measures where I want to disply it this way. So creating 5 calculated fields for every measure is really a last option.
Also: I now solve it using 2 different sheets on the dashboard. One sheet with actual numbers, and one sheet with percentages (hiding the actual column). But then the line up is not so nice, and also when the sorting of the dimension changes, it is tricky. I have also options to drill down the hierarchy of a dimension, and with two sheets, one of the two will of course not adapt then.
Currently you are using F1 for rows and F2 for columns and measures that will split to as many values as F2 has (Currently their are 3 columns).
Solution that I can think of in this particular case is to remove F2 from columns part and create 5 formulas for the measures.
Actual Sum // Since we don't want Acutal (%diff) we won't create that formula
Budget sum
Budget (%Diff)
Estimate Sum
Estimate (%Diff)
Now formula will be like
If F2 = "Actual" //Same goes for Budget and Estimate
Then f3
End
Take one more sheet now add the quick table calculation for difference for Budget and Estimate and add those to Formula fields.
Now place all 5 formulas in columns part, So you have your measures.
To add the column headings you can use dashboard, Add the sheet to dashboard and manually add texts to the measures that will look like the one you have attached in screen shot.
I have implemented a sample using Sample super store and attaching the screenshot for the same.
I needed some help with Excel functions as I am not really sure how to achieve this.
Basically, this picture shows my data structure:
I am aware that I can use Index& Match excel functions together for columns but I am not sure if it is possible use Index&Match together on two row conditions.
Requirement:
I have three products, product A, product B and Product C. I want to be able to quickly calculate the actual revenue and and you can see the data structure in the image above. My top-most row is month. For each month, I have 4 columns, of which 2 need to be calculated should the condition match.
This is the condition. An example, for product A, calculate the total sumproduct(multiples column actual customers x Price Actuals) for yearMonth 201501.
So basically,first, for product A, it would need to find YearMonth 201501, and when it is found, it should find columns Actual Customers and Price Actuals and return the SUMPRODUCT of Actual Customers and Price Actuals.
Is it possible to do this?
I have searched the Internet a bit and I have not found a solution.
Update:I thought I could post the follow-up question in the same thread insted of Cristiano duplicates... For the accepted answer, in the excel formula, how can it be divided by the total amount of "actual customers" for that month?
Simply adding "actual customers" with a slash before IT does not work.
You need a cell where you specify the month you want to look up. Give that cell the name "TheMonth".
You need a cell where you specify the product you want to look up. Give that cell the name "TheProduct".
Then, assuming your screenshot starts in cell A1, you can use
=SUMPRODUCT($B$3:$I$5*($B$1:$I$1=TheMonth)*(($B$2:$I$2="Actual Customers")+($B$2:$I$2="Price - Actuals"))*($A$3:$A$5=TheProduct))
Next time, please post a link to a workbook. It's not much fun typing in the text and numbers from a screenshot in order to verify a formula.
Here is the workbook with the formula in action.
I am using a spreadsheet to count sold items for several teams.
Rows: Individual Seller
In column A I have the specific team the seller belongs to.
In column B I have the amount of items that the seller sold.
In a separate row at the end of the document, I am trying to calculate the total number of items being sold from a specific group.
Can anyone help me write the code needed to return the total number of items sold for each specific team?
The image shows some sample data in A1:C13, and three different ways to sum the amounts by teams. There are many others ways. Of the three I recommend #Jerry’s suggestion of a PivotTable (E2:F6) because it is very easy to set up, very quick in operation and offers a great deal of versatility beyond merely summing amounts by team. For example if your data included dates of sales it could sort and group by week, month, year etc. The second version of it (E8:F14) shows a breakdown by Seller of the 20 total, but by the number of ‘sales’ (rows) rather than number of items sold.
The formula in D20 (copied down to D22) is:
=SUMIFS(B$2:B$19,A$2:A$19,A20)
However SUMIFS was not available as a standard MS Office function before Excel 2007, though SUMIF was, so in B20, also copied down to suit:
=SUMIF(A$2:A$19,A20,B$2:B$19)
SUMIFS allows more conditions than SUMIF, so for example can be changed in D20 to:
=SUMIFS(B$2:B$19,A$2:A$19,A20,C$2:C$19,"Seller1")
to obtain the amount of items comprising the two distinct ‘sales’ by Seller1 as shown by 2 in the lower PivotTable.
Since you are trying to calculate the total from a specific group the above may be more elaborate than your immediate requirement so a version that can be placed almost anywhere in your sheet (if as the example) and even copied around, replaces a variable with a fixed condition, which I have chosen to be teamB:
=SUMIF($A$2:$A$19,"teamB",$B$2:B$19)
and provided the formula is kept out of ColumnA might be further simplified by extending it to consider entire columns:
=SUMIF(A:A,"teamB",B:B)