Excel Formula to Lookup multiple columns - excel

I tried reading other questions on this matter, and everything is very specific to that person so it got pretty confusing...
Anyways, I was looking for a way to use VLOOKUP or Index Match to do the following (I've been trying but I keep running into errors or weird...long....formulas...):
I have 2 excel Sheets. One excel sheet has something like this:
(This is incomplete. I haven't put in prices yet, but I'm working on the formatting and formulas foremost. Just pretend there are prices in those empty cells :) )
The second excel sheet is this:
In the 2nd Sheet, F Column, I was trying to get a formula to match Sheet2ColumnE with Sheet1 Columns A,F,K,P,U & Z and return [depending on whether cell D is B or S] the single or bulk price for the specific item.
I've used the Index Match formula before, but it got tricky when I had to index multiple columns and match multiple columns. Is there a simple way to get this going? Or will I be looping IFs?
Thanks for assistance.
Here is the workbook. Or a sample of it...
Test.xml

Related

VBA equivalent to an index small function

Hi I have used this formula many times in excel but would like to be able to make a VBA code for it. Based off the criteria in a column "L" I would like to find the 1st and 2nd matches of name in a separate column G and add and subtract the corresponding values associated to that name (on the same rows) in different columns.
Formula: =IF(L3="1:1",INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($E$3:$E$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($F$3:$F$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($I$3:$I$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1)),IF(L3="2:2",INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))+INDEX($D$3:$D$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),2))-INDEX($E$3:$E$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($F$3:$F$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1))-INDEX($I$3:$I$5000,SMALL(IF($G5=$G$3:$G$5000,ROW($G$3:$G$5000)-ROW($G$3)+1),1)),"")
There may be a different way in VBA, this was working in the worksheet so far but got really long based of all the different criteria that could come up in column "L". My data set is about 4000 lines long with many different combinations
My data is as follows: and the expected answers are in column M using the above formula.

Excel: Count Unique Dates for set of multiple criteria

I have a large spreadsheet with many data columns and dates . Column B is the date column and there are multiple rows of duplicate dates with different data in the following columns. I'm trying to write a formula to give me a count of how many unique dates there were given different criteria. I did this formula entered as an array and it worked perfectly.
=COUNT(1/FREQUENCY(IF(('NA Trades'!D:D="TSX D3")*('NA Trades'!DX:DX>16),IF('NA Trades'!B:B<>"",'NA Trades'!B:B)),IF(('NA Trades'!D:D="TSX D3")*('NA Trades'!DX:DX>16),IF('NA Trades'!B:B<>"",'NA Trades'!B:B))))
I tried expanding on this and adding more criteria but it doesn't seem to be working and giving me a result of 0. This is the array formula I tried with the added criteria
'=COUNT(1/FREQUENCY(IF(('NA Trades'!D:D="TSX D3")*('NA Trades'!DX:DX>16)*('NA Trades'!DQ:DQ<-2.6),IF('NA Trades'!B:B<>"",'NA Trades'!B:B)),IF(('NA Trades'!D:D="TSX D3")*('NA Trades'!DX:DX>16)*('NA Trades'!DQ:DQ<-2.6),IF('NA Trades'!B:B<>"",'NA Trades'!B:B))))
Where did I go wrong with the second formula and how can I format this formula so I can continue to add more criteria?
Your formula seems to be working fine, are you sure you have the correct data in your newly added column? BTW, I would suggest that you use named ranges or a table - it's easier to read.

Copy data from another cell if criteria is met

I have quite a problem. In the excel spreadsheets, I have a lot of data entered into one main spreadsheet and some of the into another.
In the main Spreadsheet (Sheet1), I have column L, that has tons of entries of unique numbers. Also, I have a column Q that stores another data for a lot of entries into the sheet.
In another sheet (Sheet2), I might have some of the entries that can be the same with the column L in the Sheet1, and they are stored in column D, on Sheet2. So, if those two sheets entries matches (L:L in Sheet1 with D:D in Sheet2), I want to have the Q entry from Sheet1 into my, lets say N column at Sheet2. If they don't match, blank would be ok.
I've been searching the solution for quite a time, found some on Microsoft official website, but I haven't been able to apply it.
This one was the closest solution I could find, but, since I'm newbie with Excel, I haven't been able to implement it correctly.
Edit:
To Illustrate a bit, here is exactly what I am looking for:
Lets say:
Sheet1
L2=115457; Q2=2148446
L3=381493; Q3=Blank
L4=121214; Q4=484846
L5=151515; Q5=Blank
Sheet2
D143=381493; N143=(need input from Q2)
D523=121214; N523=(need input from Q4)
D968=151515; N968=(Blank)
Thanks in advance.

Sumproduct in excel using external data source

I am trying to calculate some data in a excel using external excel file. My formula is like;
=SUMPRODUCT(--('[Stock Register.xlsx]Stock Code 1'!$E$3:$E$500="Issued to Sanitary Syndicate"),'[Stock Register.xlsx]Stock Code 1'!$C$3:$C$500)
This works fine for me. But I need the sheet (Stock Code 1) being changed automatically when dragging or pasting on the next rows.
I am using it a new workbook using external data source (Stock Register.xlsx). Stock Register consisting of 570 sheets and for each sheets I need to display results in that New Workbook in cell (C1) using above formula and drag it to cell (C70).
You can add two columns before the SUMPRODUCT.
First column, say this is in column B, will need to have CONCATENATE to the external spreadsheet that you want to link to. For example:
=CONCATENATE("[Stock Register.xlsx]Stock Code",ROW(A1),"!$E$3:$E$500")
This should give you [Stock Register.xlsx]Stock Code 1!$E$3:$E$500.
Same thing for the second column that you want for $C$3:$C$500 so you can get [Stock Register.xlsx]Stock Code 1!$C$3:$C$500.
Then the third column, say this is in column D, will be the SUMPRODUCT formula that with INDIRECT. And here you go:
=SUMPRODUCT(--(INDIRECT(B1)="Issued to Sanitary Syndicate"),INDIRECT(C1))
Hope this helps.
P.S. One thing I noticed when combining all three into one column, the formula wouldn't work. Someone probably can come up a better way but to have a reference address sit next to the result may benefit you to debug down the road. Just a thought.
UPDATED:
Okay, I was able to recreate what I described below. Maybe it is easier to show you in screenshots:
See I created three sheets in Stock Register.xlsx file, Stock Code 1 sheet looks like below that values under column C and descriptions under column E.
And another spreadsheet called Results.xlsx. Column B has a formula of =CONCATENATE("'[Stock Register.xlsx]Stock Code ",ROW(A1),"'!$E$3:$E$500").
In this picture, Stock Code 2 sheet looks like below.
Column C in Results.xlsx spreadsheet has a formula of =CONCATENATE("'[Stock Register.xlsx]Stock Code ",ROW(A1),"'!$C$3:$C$500").
In this picture, Stock Code 3 sheet looks like below.
Column D in Results.xlsx spreadsheet has a formula of =SUMPRODUCT(--(INDIRECT(B1)="Issued to Sanitary Syndicate"),INDIRECT(C1)).
Try again and let me know.

Find and Compare Two Columns Excel (With Screenshots)

I have a spreadsheet that will occasionally get new data that I don't know the contents of, I just have to add it to the spreadsheet. Some of the new data is just updating rows that are already in the spreadsheet, and other data is adding new rows. I'm looking for a way to add a column that will tell me if something has changed in the row when I compare the old spreadsheet to the new one.
The sheets have one column that will always have a unique value among all the rows, so I can use that to match rows if the sheets aren't sorted the same way. Here are some screenshots to show what I'm trying to do:
Old Spreadsheet:
New Spreadsheet:
The only solution I can think of is a large nested IF formula that compares each column one by one, something like:
=IF(Old!B2=New!B2,IF(Old!C2=New!C2,"NO","YES"),"YES")
The problem with that is that it gets very hard to look at since my actual data is using 33 columns (not including this "Changed?" column) and new columns could be added in the future.
I'm not very technical with Excel, nor have I ever used VBA, so I apologize in advance if there is a simple/obvious solution that I'm missing.
Thanks in advance for your help.
Using your example, in the 'New' sheet cell D2 and copied down:
=IF(COUNTIF(Old!A:A,A2)=0,"YES",IF(SUMPRODUCT(COUNTIF(INDEX(Old!A:AG,MATCH(A2,Old!A:A,0),0),LEFT(A2:AG2,254)&"*"))=SUMPRODUCT(COUNTIF(A2:AG2,LEFT(A2:AG2,254)&"*")),"NO","YES"))
vlookup would also work well for this problem.
in D2, the formula would be:
=IF(AND(VLOOKUP(A2,Old!A:C,2,FALSE)=B2,VLOOKUP(A2,Old!A:C,3,FALSE)=C2),"NO","YES")
The column numbers (2 and 3) are the columns that correspond to the data you are trying to match, using the ID column.
It's possible to find the appropriate column using MATCH if the column names you have match the column names in the old sheet
This would make the formula look more complex, but Excel would adjust the Old!A:C reference if more columns are inserted.
The formula would look like this to match against column names
=IF(AND(VLOOKUP(A2,Old!A:C,MATCH($B$1,Old!$1:$1,0),FALSE)=B2,VLOOKUP(A2,Old!A:C,MATCH($C$1,Old!$1:$1,0),FALSE)=C2),"NO","YES")
The difference between this and the last one is the use of MATCH($B$1,Old!$1:$1,0) to find the column (using $s to anchor the lookup values)
In this case, specialized software for Excel compare is better.
My company use this software. Check it out.
http://www.suntrap-systems.com/ExcelDiff/
http://www.youtube.com/watch?v=QQgnWr_RT-8

Resources