Index-Match and #REF - excel-formula

I'm using this line of code:
=INDEX('Inventory Prices'!$D$2:$K$802, MATCH(C88,'Inventory Prices'!$C$2:$C$818,0), MATCH($D87,'Inventory Prices'!$D$1:$K$1))
Column A has a drop down for item category, Column B brings up a drop down list using INDIRECT(A-) and Column C brings up the item code for the item in B from our database. The code then looks to a price sheet, finds the item and displays one of 6 prices (based upon discount, selected via another drop down in Column D.
The inventory is 817 lines long. The code has worked for 38 items but suddenly the last 15 out of the 817, each of the 15 brings back #REF. The data is all Number. I have removed any formatting. There doesn't seem to be an explanation for why suddenly and on the last 15 items, the code doesn't work.
Anyone have any ideas?

Related

Excel, Match lookup array to ignore hidden rows

NOTE: I'm using Excel 2016, don't have access to the good stuff in 365 :(
I'm trying to build a summary sheet at the moment. The idea is to filter a table, then have the summary formulas pick out the top 5 values in a given column.
To do this I'm trying to use the Large function in Aggregate which will help me ignore hidden rows while also allowing me to extract the nth largest value.
From there I had thought to use match to find the row number of that value within the column so that I could also get text based values from the same row by assigning a column letter via Indirect.
^This is the crux of what I'm trying to do^
The code looks like this at the moment... (Sales is column "R")
=MATCH(AGGREGATE(14,5,Table1[Sales],1),Table1[Sales],0)+62
Would then go be
=INDIRECT("N"&MATCH(AGGREGATE(14,5,Table1[Sales],1),Table1[Sales],0)+62)
Aggregate(14 = Large*
Aggregate(,5 = Ignore hidden rows*
The 62 there at the end is there as the data in the table starts on row 63 (making it more robust with row() is on my list but not there yet).
The issue I'm having is it seems the lookup array in the Match function Table1[Sales] isn't being filtered as the table is being filtered.
At least that's what the results I'm seeing are indicating to me as the row number I'm getting back isn't within the filtered table (I.e. Match is returning a hidden row number).
My question is if anyone has an idea about how make this so that only visible rows are considered within the array.
(If I've completely missed the mark with this and someone has a better idea about how to accomplish this goal (without having to resort to array functions) I'd be very grateful).
Thanks!
Expected results
row
A
B
1
Company A
425
2
Company B
1500
4
Company A
1200
7
Company C
750
15
Company B
100
19
Company A
100
I'd be looking for the nth largest value in column B, say 1200 (second largest) in this example.
=MATCH(AGGREGATE(14,5,B:B,2),B:B,0)
=MATCH((1200),C:C,0))
=3
The expected result is Row 4, but because (again, it seems) the look-up array isn't excluding filtered/hidden rows, it is returning Row 3 instead.
I hope this is a bit clearer!

Pull a third value on the basis of two criterias using INDEX and MATCH in excel

Needed some help with the INDEX match formula, here goes..
Have an excel with two sheets,
- Data sheet contains an inventory master of sorts where.. we can see each item being displayed with multiple batches in with each of their own quantities depending on where they're stored..
- Sheet 1 is an order form in which my end user would like to get the exact batch of a product on the basis of two criterias.. Criterias being - product number and qty match to fullfill..
Data - Current Inventory
Item Quantity Batch
ABD 10 11223a
ABD 15 24589r
DFG 5 T45678
DFG 67 ghytu8
FGH 10 thnh67
FGH 10 huip78
Sheet 1 - Order form
Item Quantity Batch
ABD 8
DFG 4
DFG 10
FGH 10
I have now tried the following formula for INDEX/MATCH in the batch field for sheet 2 but it does not seem to work.. please advise..
=INDEX(Data!C12550:R19719,MATCH(1,(Data!C12550:C19719=Sheet1!A2)*(Data!D12550:D19719=Sheet1!B2),0),7)
Note in the actual sheet the batch numbers in sheet 1 lie on the 7th Column thus the column referenced at the end is 7..
Thank you.
I have done something like this before.
I would go like this.
Add a helper column to your datasheet where you concatenate Item and quantity.
In your Order form you can simply index the batch number only and do a match of the concantenated Item & Quantity in your helper column.
This is the Data sheet setup
Then On the order form:
Hope this helps.
This issue has been resolved now... I figured out the correct formula, however it refused to work between 2 different sheets due to some circular reference error that wasn't going away..
So ive made a separate section on the same data sheet and applied the following formula which works perfectly!
> =INDEX(C:R,MATCH(1,(C:C=W3)*(R:R>=Y3)*(D:D>=X3),0),3)
This now has multiple criteria's that I can work with..

Excel: How to find the last empty Cell

In Excel, does anyone know how to look Upward from a given row to find the last blank Cell?
I've got a strangely formatted excel export that I'm trying to report out of. However, i'm stuck trying to find an efficient formula to find the data.
Here are 2 examples of the exported format of this report. For each "Item Number" it's listing all the parts it's used in. This might be just one SKU, or 15 SKUs, or none. So this causes sub-header area to not be a consistent size. Each new Item number gets this same format. I've got 8000+ Item numbers, each output this same format.
here is the array formula:
{=INDEX($B$1:$B$70600,SMALL(IF("Item Number:"=$A$1:$A$70600,ROW($A$1:$A$70600)-ROW($A$1)+1),COUNTIF(INDIRECT("$A1:$A"&ROW()),"Item Number:")))}
My formula basically looks for the SKU (i.e. 35376) and reports back the above Item number it uses (i.e. 02859). It does this by finding the row number of the SKU, and then counting the number of strings "Item number:" from the top to current row, and reports the last one.
**
Created By: Employee
Create Time: 01/08/2015 04:16:16 PM CST
Where Used Report
Item Number: 02859
Description: Packaging 35376
Level Subclass Number Rev Description Find Num Qty BOM Notes
.. 2 SKU 45268 A        MCO-01101 Product Name  0 1
Created By: Employee
Create Time: 01/08/2015 04:16:16 PM CST
Where Used Report
Item Number: 02858
Description: Packaging 35345
Level Subclass Number Rev Description Find Num Qty BOM Notes
.. 2 SKU 35376 E        ECO-07812 Product name 0 1
.. 2 SKU 39022 A        MCO-01198 Product Name  0 1
.. 2 SKU 39033 A        MCO-01187 Product Name 0 1
**
However, my current function is crashing out as i've got 70k rows it's searching through.
What I'd rather do, is simply look UPWARDS in the sheet to find the row number of the last header value (i.e. "Number") or even just the last empty cell. Instead, it seems that most of the functions are geared around looking down to the next value. Which forces me to look from the Top to the current row.
Anyone know how to look Up from a given row to find the last blank Cell?
You can use LOOKUP in various ways to get the last occurrence of some value, e.g. this formula in row 100 will find the last instance of "Item Number:" in column A above and return the corresponding value from column B
=LOOKUP(2,1/(A$1:A99="Item Number:"),B$1:B99)
This can be fast if you know how many rows you need to look at, e.g. if the previous "Item number" will always be within 30 rows you can set the range in the formula to look at only 30 rows
It's possible using SUMPRODUCT, but s it searches all 10xxxxx cells in a column, don't have too many, else the spreadsheet will slow to a crawl.
=INDEX(B:B,SUMPRODUCT(MAX((A:A="Item Number:")*ROW(A:A))))
This will return the data in column B where the last "Item Number:" appears

Return Value in a column based on value in a subset in another column

I'm working on taking information from a table like so:
A 1
2
B 3
1
4
C 2
5
Essentially, a series of sets (A,B,C) with their elements arranged vertically beside them.
What I'm trying to do is retrieve the list of column 1 values that have a certain value in column 2. For instance, if the lookup value for column 2 was 1, I would want A and B to match, but not C. Best case scenario, I could generate a new column containing the matches. Is there a way to do this without resorting to VBA?
EDIT:
The data I am working with is not so clean, here's a doctored version of it
1 2 3 4
83 Fun Edit ZZZZZZ*AAAAAA 210
365,400 176
210
85 Fun Edit 600,500 205
MEDICARE[705] 176
200
The extracted data does not like to preserve relationships between data beyond the column 1 identifier. In this case, the information in column 3 "###, ###" comes from item 176 in column 4. So filling down and taking the row will result in issues downstream.
In the long run, the data in column 4 is just a key for matching the information in this extract with another one.
I appreciate everyone's help thus far, and apologize for my insufficient original example.
Here's a short workflow that will do it:
Select the entire range
Press Ctrl+G (Goto)
Click Special
Tick Blanks and OK
Type = and arrow up. You should have a formula that looks like =A1
Press Ctrl+Enter. At this point all the missing alpha values should be filled in.
Apply Autofilter and filter the numbers to show only 1
If you want to use the filtered alpha list elsewhere, copy the values showing, and paste elsewhere.

Subtracting columns in a Vlookup

I have a Excel spreadsheet that has two tabs, I have data on the DATA tab and the results of the data on the RESULTS tab. On the RESULTS tab I need to create a vlookup that will look for data on the DATA tab and subtract Column A from Column B. Is this possible with vlookup?
I have a before and after with the same clientID but data being copied/pasted will change.
Before
A B C
1021 102 125.00
1022 102 150.00
1023 105 100.00
After
A B C
1021 102 125.00
1022 102
1023 105 100.00
So each day I take the AFTER number and paste them over the before number, and get my new AFTER numbers from another tab.But if the pasted AFTER number does not have data for that specific account (in this case 1022), and the new AFTER number I get from another tab does not have data for 1022, my comparision will be off an account and will not notify me that this account is missing. I'm sorry, i know that is probably confusing.
I don't actually get why you need to use VLOOKUP to substract two columns...
In the results tab, you could just type
=IF(AND(DATA!B1<>"",DATA!A1<>""),DATA!B1-DATA!A1,"")
And copy the formula down the whole column.
The IF condition checks if both DATA!B1 and DATA!A1 are not empty, in which case it means they both have data and it will substract it. If one of the two columns is empty, it won't do anything, which is what you want.
If I didn't understand your question correctly, feel free to comment and clarify and I will propose something else.
Edit for VLOOKUP solution: I'm assuming that the client IDs are in column A in both tabs and you have to substract B from C in the same row as the ID in the DATA tab.
In RESULTS, use the following formula (put this one in row number 1 and copy it down):
=VLOOKUP(A1,DATA!A:C,3,FALSE)-VLOOKUP(A1,DATA!A:C,2,FALSE)
This will return 0 if both fields are empty, C if only B is empty and -B if only C is empty.
I can modify this if you need a different behavior depending on which columns are empty.
Hope this helps!
Yes it is possible with Vloopup.
=VLOOKUP(ResultsRefID,DATAarray,col1,FALSE)-VLOOKUP(ResultsRefID,DATAarray,col2,FALSE)
you could use that formula where ResultsRefID is the unique row identifier you are trying to get data for, DATAarray is all of the data in the DATA worksheet, and col1/col2 are the columns of data you want to have subtracted.
You can get the same results a little easier (I think) with an IF statement as an array.
=IF(ResultsRefID=DATAarrayUniqueIDrow1:DATAarrayUniqueIDrow1lastRow,col1FirstRow:col1LastRow-col2Firstrow:col2LastRow,"match not found.")
The IF statement has to be entered as an array (ctrl+shift+return)

Resources