I have the following data in Excel Worksheet A, which is a basic ledger of expenses:
The initial data looks like:
Week | Amount | Payee | Category
1 | 10.00 | John | Cookies
1 | 12.00 | Bill | Cookies
3 | 7.08 | Jason | Oranges
...
And I have assigned categories and calculate subtotals like this on another sheet using SUMIF :
Category | Total | Include?
Cookies | 22.00 | True
Oranges | 14.87 |
...
I'm trying to get to a report that sums if that Include? boolean is set. By using SUMIF again, I can summarize by week:
Total IncludeSet?
1 100.06
2 100.3 22.00
3 80.07
4 77.29
...
I know I could create an Extra column, and I could also try a SUMIFS and apply multiple criteria, but I'm up for learning how the pros would tackle this. At some point, I should just put this into MATLAB or a database.
Related
I have an excel workbook where I am trying to count the number of apples in a named table. The workbook has multle sheets each named Jan, Feb, Mar, etc. with a corresponding table range of the same name.
My main worksheet has a list of months as columns and fruit as rows, I want to use a countif or suitable function to count the number of each fruit per month using the column heading as the worksheet portion of the formula.
This is what I have tried, this works, but has to be manually coded for each month, i would prefer it be more dynamic.
=COUNTIF(JAN[Labels],$A2)
Note: A2 contains the word apple
I have tried to get the month from the column date but it doesnt work
=COUNTIF(TEXT(E25,"mmm")[Labels],$A2)
This is roughly what the "master" table should look like (for clarity)
| | Jan-20 | Feb-20 | Mar-20 | .... |
| Apple | 4 | 3 | 5 | ... |
| Pear | 5 | 4 | 9 | ... |
EDIT:
Just to assist with anyone trying to help, this is roughly what a table on another sheet will look like:
| invoice | labels|
| 12535 | Apple |
| 12536 | Pear |
| 12537 | Apple |
This table would be a named table of Jan or Feb, etc.
Please try this:-
=COUNTIF(INDIRECT(TEXT(G2,"mmm")),"A")
G2 contains a proper date.
Here is a variation of the above where column 2 of the table is specified as the range to count in.
=COUNTIF(INDEX(INDIRECT(TEXT(G2,"mmm")),0,2),"B")
If you must use column captions to identify the column I would suggest MATCH to find it.
OK, so I found an answer, combining the above answer by Variatus with an additional new row.
| A | B | C | D |
1| | Jan-20 | Feb-20 | Mar-20 |
2| |JAN[Labels]|FEB[Labels]|MAR[Labels]| <- =UPPER(TEXT(B1,"MMM"))&"[Labels]"
3|Apple | 5 | 7 | 3 | <- =COUNTIF(INDIRECT(B$2),$A3)
4|Pear | 7 | 2 | 9 |
5|Orange| 1 | 3 | 3 |
So formula in B2 makes an uppercase text value of the month from B1 plus the column name Labels.
The formula in B3 (and down) counts the number of instances of the fruit from the named table & column shown in B2.
I've spent pretty much all day trying to figure this out. I've read so many threads on here and on various other sites. This is what I'm trying to do:
I've got the total sales output. It's large and the number of items on it varies depending on the time frame it's looked at. There is a major lack in the system where I cannot get the figures by region. That information is not stored in the system. The records only store the customer's name, the product information, number of units, price, and purchase date. I want to get the total number of each item sold by region so that I can compare item popularity across regions.
There are only about 50 customers, so it is feasible for me to create a separate sheet assigning a region to the customers.
So, I have three sheets:
Sheet 1: Sales
+-----------------------------------------------------+
|Customer Name | Product | Amount | Price | Date |
-------------------------------------------------------
| Joe's Fish | RT-01 | 7 | 5.45 | 2020/5/20 |
-------------------------------------------------------
| Joe's Fish | CB-23 | 17 | 0.55 | 2020/5/20 |
-------------------------------------------------------
| Mack's Bugs | RT-01 | 4 | 4.45 | 2020/4/20 |
-------------------------------------------------------
| Joe's Fish | VX-28 | 1 | 1.20 | 2020/5/13 |
-------------------------------------------------------
| Karen's \/ | RT-01 | 9 | 3.45 | 2020/3/20 |
+-----------------------------------------------------+
Sheet 2: Regions
+----------------------+
| Customer | Region |
------------------------
| Joe's Fish | NA |
------------------------
| Mack's Bugs | NA |
------------------------
| Karen's \/ | EU |
+----------------------+
And my results are going in Sheet 3:
+----------------------+
| | NA | EU |
------------------------
| RT-01 | 11 | 9 |
+----------------------+
So looking at the data I made up for this question, I want to compare the number of RW-01's sold in North America to those sold in Europe. I can do it if I add an INDEX MATCH column to the end of the sales sheet, but I would have to do that every time I update the sales information.
Is there some way to do a SUMIFS like:
SUMIFS(Sheet1!$D:$D,Sheet1!$A:$A,INDEX(Sheet2!$B:$B,MATCH(Sheet1!#Current A#,Sheet2!$A:$A))=Sheet3!$B2,Sheet1!$B:$B,Sheet3!$A3)
?
I think it's difficult to do it with a SUMIFS because the columns you're matching have to be ranges, but you can certainly do it with a SUMPRODUCT and COUNTIFS:
=SUMPRODUCT(Sheet1!$C$2:$C$10*(Sheet1!$B$2:$B$10=$A2)*COUNTIFS(Sheet2!$A$2:$A$5,Sheet1!$A$2:$A$10,Sheet2!$B$2:$B$5,B$1))
I don't recommend using full-column references because it could be slow.
BTW I was assuming that there were no duplicates in Sheet2 for a particular combination of customer and region - if there were, you could use
=SUMPRODUCT(Sheet1!$C$2:$C$10*(Sheet1!$B$2:$B$10=$A2)*
(COUNTIFS(Sheet2!$A$2:$A$5,Sheet1!$A$2:$A$10,Sheet2!$B$2:$B$5,B$1)>0))
EDIT
It is worth using a dynamic version of the formula, though it is not elegant:
=SUM(Sheet1!$C2:INDEX(Sheet1!$C:$C,MATCH(2,1/(Sheet1!$C:$C<>"")))*(Sheet1!$B2:INDEX(Sheet1!$B:$B,MATCH(2,1/(Sheet1!$B:$B<>"")))=$A2)*
(COUNTIFS(Sheet2!$A$2:INDEX(Sheet2!$A:$A,MATCH(2,1/(Sheet2!$A:$A<>""))),Sheet1!$A2:INDEX(Sheet1!$A:$A,MATCH(2,1/(Sheet1!$A:$A<>""))),Sheet2!$B$2:INDEX(Sheet2!$B:$B,MATCH(2,1/(Sheet2!$B:$B<>""))),B$1)>0))
As you would need to make the match in memory I don't think it's feasible in Excel, you'll have to use a vba dictionary.
On the other hand, if the number of columns is fixed in your sales sheet, you can just format as table and add your index match in F.
When updating the sales data delete all lines as of line 3 and copy paste the update value. Excel will automatically apply the index match on all rows.
I am attempting to create an efficient way to log our customer orders. So far what I've done is have the customer names in the 1st column. Contact details in the 2nd. Then in the sequential columns I have created drop down boxes to select the appropriate product and in the following column is the quantity.
Because of how customers order, the same products may not necessarily be in the same column Meaning it may read something like this...
Name. Number. Product1. Qty Product2. Qty. Product3. Qty
Name. Number. Product 3. Qty. Product 1. Qty. Product 2. Qty.
Name Number.. Product 3. Qty.
Name. Number. Product 2. Qty. Product 3. Qty.
So what I want to do is create a totals list for each product by pairing it with the relevant qty. But I'm struggling to find an appropriate method. So far I have found the means to count how many time each product is ordered, but not able to match that with the qty.
So if someone can help me do so I would much appreciate it.
p.s. I am using Excel 2007
It won't be a short formula as you need to specify each of the columns that need to be summed, but the best function would be SUMIF which uses this syntax:
SUMIF(range, criteria, [sum_range])
Applied to your data you would need to also use SUM to total the totals of each column, for example if your data looked like this:
| A | B | C | D | E | F | G | H
---------------------------------------------------------------------
1| Name | Number | 1 | Qty | 2 | Qty | 3 | Qty
2| Test1 | 123 | Product1 | 4 | Product2 | 5 | Product3 | 2
3| Test2 | 456 | Product3 | 2 | Product1 | 1 | Product2 | 5
4| Test3 | 789 | Product3 | 3 | | | |
5| Test4 | 112 | Product2 | 2 | Product3 | 1 | |
You could use the following formula to total all the Products named "Product1":
=SUM(SUMIF(C2:C5,"Product1",D2:D5),SUMIF(E2:E5,"Product1",F2:F5),SUMIF(G2:G5,"Product1",H2:H5))
Which would equate to 5 using the example data.
I have an Excel document containing 2 sheets:
All purchases
Invoices
I would like to find a simple method to add items from 'All purchases' to 'Invoices' based on the date.
Example:
All purchases:
Date | Name | Sum
----------------------------------
2013-01-01 | Pottery | $12.00
2013-01-01 | Liquids | $1.00
2013-01-09 | Baby food | $12000.00 <
2013-01-02 | Car | $12.00
2013-01-09 | Lego | $50001.00 <
2013-01-02 | Car part | $10000.00
2013-01-09 | More Lego | $50001.00 <
Based on the date 2013-01-09 I want to automatically fill the 'Invoices' in the following way:
Date | Name | Sum
----------------------------------
2013-01-09 | Baby food | $12000.00
2013-01-09 | Lego | $50001.00
2013-01-09 | More Lego | $50001.00
Can this be done without macro?
I know about camera, pivot tables, lookups, indices, but I could not combine them into a usable solution.
My other plan is to look up the collection for every cell and retrieve the 1st one for the 1st row, 2nd for the 2nd row. Is there a simpler solution?
I have a summary table like this:
Total Pay | Amount Unpaid | Total Left
It is based on a table with the following format:
Date | Hours | Pay | Paid
... | 5 | 100.00 | Yes
... | 4 | 80.00 | No
... | 6 | 120.00 | Yes
I am trying to create a formula that will fill in the Amount Unpaid column.
I have this so far which gives me the error: 'Error in Value':
=SUM(IF(Sunshine!E5:E6,Sunshine!D5:D6,0))
You can use the SUMIF function:
=SUMIF (E2:E5, "No", D2:D5)
This will add all values in D2:D5, but only if the corresponding row in E2:E5 equals "No".