Excel Column Formula with Conditional Value - excel

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".

Related

Excel formul to count Table Range using month from date text

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.

Success rate based on date

I'm a total excel noob. I'm trying to find "Today's Success rate" based on 2 columns. One column is the date of an attempt, the other is success/fail. I have a formula for getting the overall success rate, but it just uses one column. I need to get today's success rate. There are other columns, but don't worry about those.
The problem I'm having is finding a different column cell value from a result of searching the date column. SO, find today's date in column A, then sum up the true values from column B and divide by total.
| Date Col A | Success Col B |
| ------------- | ------------- |
| 4/1/2019 | true |
| 4/1/2019 | false |
| 4/2/2019 | true |
| 4/2/2019 | false |
| 4/2/2019 | true |
| 4/2/2019 | false |
| 4/2/2019 | false |
This is the formula I have for calculating the overall success rate
=100*COUNTIF(B2:B1000,"true")/SUM(COUNTIF(B2:B1000,"true"), COUNTIF(B2:B1000,"false"))
Assuming today is April 2, 2019, the above table should have
Today's Success Rate: 40%
=COUNTIFS($A$3:$A$9,$D$2,$B$3:$B$9,TRUE)/COUNTIF($A$3:$A$9,$D$2)
This should work. I put "today's date" in cell D2 so make sure you adjust the formula accordingly. Another thing to note is make sure that your true false entries in column B are in the same format as it is in the formula (meaning all caps or no caps).
With text values in cols A and B, use:
=SUMPRODUCT(--(A:A="4/2/2019")*(B:B="true"))/SUMPRODUCT(--(A:A="4/2/2019"))

Return status of customer from most recent contact date

I have a list of customers, and a spreadsheet that tracks each encounter with them. A sample table looks like this:
Workbook 1: Table of customers
+------------+----------------+---------------------+
| Name | Current Status | Last Date Contacted |
+------------+----------------+---------------------+
| Customer A | Active | 3/1/2018 |
| Customer B | Inactive | 3/2/2018 |
| Customer C | Closed | 3/3/2018 |
+------------+----------------+---------------------+
Workbook 2: List of encounters
+------------+------------+----------+
| Name | Status | Date |
+------------+------------+----------+
| Customer A | New | 1/1/2018 |
| Customer A | Active | 2/1/2018 |
| Customer A | Active | 3/1/2018 |
| Customer B | New | 1/2/2018 |
| Customer B | Active | 2/2/2018 |
| Customer B | Disengaged | 3/2/2018 |
| Customer C | New | 1/3/2018 |
| Customer C | Active | 2/3/2018 |
| Customer C | Closed | 3/3/2018 |
+------------+------------+----------+
I have the following formula to return the last date contacted:
{=MAX(IF(Encounters[Name] = [#[Last Then First Name]], Encounters[Date])))}
I would like a formula that looks for the most recent date for each Customer, and return the status associated with that date. Is there a way to do this with formulas. Keep in mind that the formula would need to continue to work even if the worksheet were to be sorted. Thanks!
Assuming your table of customers is in Sheet1 (columns A to C) and your list of encounters is in Sheet2 (column A to C), and you already have your latest date of encounter per customer in column C of Sheet1, then you can enter the following formula in Sheet 1 cell B2 (then drag down to your last customer):
=INDEX(Sheet2!$B:$B,MATCH(1,(Sheet1!$A2=Sheet2!$A:$A)*(Sheet1!$C2=Sheet2!$C:$C),0))
This allows you to capture the latest status per customer. The formula would however be pretty taxing on the efficiency of Excel's calculation, so you can change the reference ranges to your structured table references. Please don't forget to return the formula using CONTROL+SHIFT+ENTER.
Use the following standard (non-CSE) formulas to gain the latest date and accompanying status per the supplied image.
'G2
=INDEX(B:B, AGGREGATE(15, 7, ROW(A:A)/((A$1:A$10=F2)*(C$1:C$10=H2)), 1))
'H2
=MAX(INDEX(C$2:C$10-(A$2:A$10<>F2)*1E+99, , ))

Is it possible to populate sumif with dynamic range

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.

Dynamically construct range to use in XIRR formula

I have a sheet in this form:
Fund | Date | Amount
A | 10-Jan-05 | -5000
A | 10-Feb-05 | -5000
A | 08-Oct-13 | 12500
B | 10-Sep-05 | -5000
B | 10-Oct-05 | -5000
B | 10-Nov-05 | -5000
B | 08-Oct-13 | 22500
I'm looking for an output column that provides the XIRR for each fund. The XIRR function takes values and dates as ranges. I need a way to dynamically construct the range using the fund name as a search criteria.
Fund | XIRR
A | ...
B | ...
I could manually specify the range for each fund after sorting it by name, but its not a scalable solution.
You can use OFFSET to get the correct ranges, e.g. this formula
=XIRR(OFFSET(C$2,MATCH(A11,A$2:A$8,0)-1,0,COUNTIF(A$2:A$8,A11)),OFFSET(B$2,MATCH(A11,A$2:A$8,0)-1,0,COUNTIF(A$2:A$8,A11)))
see screenshot

Resources