Excel find if user paid monthly invoice - excel

I have two worksheets
Worksheet1 looks like:
Customer | June | July | August
John | | |
Jane | | |
Bob | | |
Ann | | |
Worksheet2 looks like:
Customer | Paid Amount | Month
John | $50 | June
Jane | $20 | June
Bob | $100 | June
Ann | $10 | June
John | $30 | July
Jane | $40 | July
Ann | $5 | July
Bob | $10 | August
John | $10 | August
Jane | $20 | August
In Worksheet1 I need a formula that simply returns a string, like "Paid" or "Not Paid", by taking the Customer name from Worksheet1, doing a lookup on Worksheet2 for that customer name, and checking if there is a payment record for that month. Based on the example data above, the result in Worksheet1 should look like:
Customer | June | July | August
John | Paid | Paid | Paid
Jane | Paid | Paid | Paid
Bob | Paid | Not Paid | Paid
Ann | Paid | Paid | Not Paid
I tried the following:
IF(ISNA(VLOOKUP([#Customer],table_from_Worksheet2,2,FALSE)),"No","Yes")
Problem is that's checking the entire Worksheet2 and not filtering by the month in question. I need to somehow tweak the VLOOKUP (or use another method such as INDEX and MATCH but I don't know how to use them) to find if customer made a payment for that specific month.

Consider using a pivot table with "month" in the column labels box, "Name" in the row labels box, and "count of paid amount" in the values box.
Select your whole table on sheet 2.
Select Insert-->PivotTable (Far left of the ribbon)
Drag and drop the categories as I described above.
This will give you a 1 in every month/name combination where a customer has paid, and a blank otherwise. Now select the interior of your Pivot Table, Right Click and "Change Format" Select Custom Format, and scroll down to the Type called "TRUE";"TRUE";"FALSE" and apply.
Right Click on the "Grand Total" and "Remove Grand Total" if you so desire.
Pivot tables are scary at first, but very powerful and worth learning.
(I added another person before I made the table below)

Place the formula in B2 on worksheet1 (Where John and June meet) and copy across and down. Be sure to enter the formula with CTRL + SHIFT + ENTER:
=IFERROR(IF(INDEX(Worksheet2!$B$2:$B$12,MATCH($A2,IF(B$1=Worksheet2!$C$2:$C$12,Worksheet2!$A$2:$A$12),0)),"Paid","Not Paid"),"Not Paid")
For a table you can use:
=IFERROR(IF(INDEX(Table_from_Worksheet2[Paid Amount],MATCH([#Customer],IF(B$1=Table_from_Worksheet2[Month],Table_from_Worksheet2[Customer]),0)),"Paid","Not Paid"),"Not Paid")
You will also need to enter with CTRL + SHIFT + ENTER
Please note, you are going to need to adjust the ranges as neccessary.

Related

Why is VLookup Inconsistent?

I'm using a VLookup in a spreadsheet and finding really inconsistent results. For example here's are 2 entries from my sheet that's using the VLookup lookup:
Date | Transaction Type | Description | Paid Out | Paid In | Balance | Category
xx-May-xx | ATM Withdrawal BARCLAYS BANK | ATM Withdrawal BARCLAYS BANK | £10.00 | | £xxx.xx | #N/A
yy-May-yy | ATM Withdrawal NAT WEST | ATM Withdrawal NAT WEST | £10.00 | | £yyy.yy | Cash
The forumla I'm using for my lookup references a CategoryLookup table, which has a bunch of blank lines (trying to eliminate potential issues) and has the following:
Description | Category
(blank lines...)
ATM Withdrawal LINK | Cash -- Row 25
ATM Withdrawal | Cash
ATM Withdrawal BARCLAYS BANK | Cash -- Row 27
The formula I'm using for my VLookup is as follows: =VLOOKUP([#Description],CategoryLookup!$A$2:$B$9999,2). I can't understand why I'm getting #N/A for some of my values. If I replace the blank lines with my previous category lookups then they seem to get returned even though they're no way near the description I'm using for lookup.
Note that unfortunately in this case I need a fuzzy lookup as other categories aren't so exact on the match/

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, , ))

Index/Match- Lookup 2nd Value if 1st Value is Blank

I was hoping to get some assistance in writing a formula in excel.
I have a table that contains a list of employees and their cell phone number. However, the table is structured in such a way that there is a number of blank and duplicate rows.
Essentially, I am hoping to create a new table without any duplicates and blanks by performing a lookup on the respective cell phone numbers.
The problem is, when I do a standard Index/Match formula, the formula will grab just the first lookup value, which more often than not, is a blank row.
How would I modify this formula to say something like, "Look this value up. If the value is blank, lookup the second value"?
Here is a sample of what the table looks like:
Table 1 (Original)
+---------------+--------------+
| Employee Name | Cell Phone |
+---------------+--------------+
| Doe, John | |
| Doe, John | 111-111-1111 |
| Smith, Eric | 222-222-2222 |
| Jones, Dave | |
| Jones, Dave | 333-333-3333 |
+---------------+--------------+
Table 2 (What I want the table to look like)
+---------------+--------------+
| Employee Name | Cell Phone |
+---------------+--------------+
| Doe, John | 111-111-1111 |
| Smith, Eric | 222-222-2222 |
| Jones, Dave | 333-333-3333 |
+---------------+--------------+
=Index(Table1[Cell Phone], Match([Employee Name], Table1[Employee Name],0))
How about the first non-blank match?
=INDEX(B:B, AGGREGATE(15, 6, ROW($2:$999)/((A$2:A$999=F2)*(B$2:B$999<>"")), 1))
'listobject table alternative
=INDEX(Table1[Cell Phone], AGGREGATE(15, 6, (ROW(Table1[Cell Phone])-ROW(Table1[#Headers]))/((Table1[Employee Name]=F7)*(Table1[Cell Phone]<>"")), 1))

How to split text after checking length in Google Sheets?

How do I split contents of a cell if the cell is not empty in Google spread sheet?
Name | DOB | Day | Month | Year
------------------------------------------
John | 01/01/1995 | 1 | 1 | 1995
Doe | | | |
Dane | 10/05/1988 | 10 | 5 | 1988
Since Doe doesn't have a date of birth, the value for day, month and year is empty.
I am currently using
=ArrayFormula(SPLIT(B1,"/"))
How to check the condition before splitting?
Posting the answer as it worked for you,
=IF(B1="","",arrayformula)
There seems no need to make any special provision for blanks (nor need for any formula). Copy the DOB column (excluding header) under Day and apply Data > Split text into columns... with Custom Separator of /.

Repeat formula until next occurrence in another cell

I'm having troubles creating an Excel formula to repeat the same copy down a column until I come to a new "person". The reason I'm doing this is to Index(Match) later to grab all this data. If I am totally off, and there's an easier way to grab this data than run a formula down 15k rows, I'm all ears. The main problem is that my categorical data (Person) is stacked on top of the data that I want to match it with (Work Positions).
The data looks like this:
Description | Status
Bob | C
Sales |
Marketing |
Management |
John | C
Sales |
Management |
Tony | C
Management |
Ideally, I'd like the data to look like this after running the formula down ColA:
Person | Description | Status
Bob | Bob | C
Bob | Sales |
Bob | Marketing |
Bob | Management |
John | John | C
John | Sales |
John | Management |
Tony | Tony | C
Tony | Management
I've tried writing an If() statement to target the "C" in ColC, as it is always there to discern a change in "Person". However, I can't figure out how to do this as of yet. Is there a way to write a formula that says keep pasting the same value until you hit the next "C", then change your paste value? Thanks for any and all help and please, don't hesitate to ask any clarifying questions!
=IF(C:C="C",B:B,A1)
Put this in A2 and clear "Person" then drag down the list.

Resources