Why is VLookup Inconsistent? - excel

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/

Related

EXCEL: SUMIFS criterion applied to a INDEX MATCH search equals a value

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.

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.

Excel find if user paid monthly invoice

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.

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.

How to present/organize repetitive data contained in cells in excel?

Would there be a better way to present/organize repetitive data contained in cells in excel? I've provided a set of sample data below (I can't show my actual records for confidentiality reasons) just so that you guys could visualize the data.
Country | Type | Company | Department | Project | Currency | Amount
USA | Restaurant | Bob's Barbeque | Sanitation | Monthly Sanitation | Records Database | USD | 100
USA | Restaurant | Bob's Barbeque | Human Resources | Staff Timesheet USD | 203
USA | Restaurant | Bob's Barbeque | Human Resources | Email Portal for Employees | USD | 259
USA | Manufacturing | Duff Autos | Research and Development | Inventory System| USD | 234
USA | Manufacturing | Duff Autos | Sales | Inventory System | USD | 654
China | Manufacturing | Weihua Electronics | Research and Development | Inventory System | RMB | 102
China | Government | Department of Tourism | Advertisement | Billboard Design and Deployment Web Portal | RMB | 2044
As you can see, it contains a lot of repetitive data like the "Country" and the "Type". It may look organized as it is but it looks cluttered as the data multiplies. I've thought this thoroughly over the past few days but I still can't figure out a way to do organize it such that it would look pretty.
I've tried Excel's filter functionality, sorting, and others but I still think it looks cluttered. Any suggestions? Thanks!
Pivot the data, then you can open and close the sections as you please. I just did it on your sample, then in the resulting pivot tick all the fields, drag the amount one from row labels to values then click on the little down arrow and choose value field settings.
Select Sum and press OK.
the + and - on the data in the pivot allows you to fold open and close the fields to make it look however you like.

Resources