VLOOKUP to match certain criteria under a certain column header - excel

I'm not quite sure how to do this.
I'm not sure if VLOOKUP's are the right tool to use for this.. considering the index im looking for is a column header name and not a number?
Here's what I have so far..
On one sheet I have my information. Three columns are dedicated to defining the data and the 4th,5th and 6th rows are the data themselves.
Description Description Description Harry Paul David
Hairy Red Foot Very No Kinda
Ugly Blue Hair None A little A lot
Pretty White Dress Yes Average Sparkle
Then, on another workbook. I want to import the data from the other sheet using this function. I have a blank table with no data in it.
Description Description Description Harry Paul David
Hairy Red Foot
Ugly Blue Hair
Pretty White Dress
I want to set it up so that if a certain cell on the import sheet. Has a cell which matches a certain criteria on the source data sheet (i,e, description1 = Hairy, description2 = Red, Description3 = Foot in the Harry column). It will display Very.
Can anyone provide any information on what I need to research? I believe it is a dynamic lookup?
Edit: I forgot to mention the the names might move around between imports (So Dave might come before John etc).
I guess this can achieved with a combination of SUMIF statements and VLOOKUP's?

1) Create a column where you concatenate your lookup keys, separated by some character (hyphen would work in the example you give) and use this value as your lookup key
2) Make sure your source sheet is sorted, and use false as the last parameter in the VLOOKUP function

Depending on requirements, you may be able to use Advanced Filter which would probably be quicker than multiple lookup formulas.
First make sure the description headers are unique on each sheet (Desc1, Desc2, Desc3), then select the import sheet and choose Advanced Filter from the Data Tab with the options:
Action: Copy to another Location
List Range: [Book1]Sheet1!$A$1:$F$4 (Source Workbook)
Criteria Range: $A$1:$C$4 (Descriptions)
Copy to: $A$1:$F$1 (Headers)
Unique Records Only: Check
This will return all unique matching records in the same order as the source data. Just repeat the command as needed and any existing values will be overwritten.

writablesheet.addCell(new Formula(0, i, "VLOOKUP(A"+i+",'Sheet2'!A$"+i+":B$6,2,0)"));
when u enter sheet name it should be in single quotes
and i indicates row index
sure this ll help you people

Related

Searching column 1 for text contained in column 2 and highlighting red if NOT found

I have the following example data set in excel.
Currently, for reference, John,Smith is in A4 and Smith Johnson is in B4.
Column 1 = Names of Members
Column 2 = Attended (list of members that attended a meeting).
Applied to column 1, I would like to add a function that turns GREEN any members that are in column 2 (attended) that are also in column 1.
Like so:
I am essentially trying to find a quick way of producing an attendance list, and highlighting those that were not present.
The difficulty is that it is not an exact match as the usernames in the attended list may contain the surname or last name but not in the format provided in column 1.
I should also mention that the attendees list could be variable, so the formula should ideally allow for a range from say B4 to B20, even if it is left blank.
Any clever and easy solutions?
To highlight those members that didn't attend:
Select A2:A9
Use conditional formatting formula rule:
=SUMPRODUCT(--ISNUMBER(SEARCH($B$2:$B$5&"*",$A2)))=0
I usually like to tell people that they will have to be carefull using partial matches to prevent false positives. What if you have someone called "Ann" and "Anne" and "Annet" and "Annette"? Therefor, allready a bit safer could be:
=SUMPRODUCT(--(LEFT(A2,FIND(" ",$A2)-1)=$B$2:$B$5))
EDIT:
Based on the new data and question you can try:
Select A4:A10
Use conditional formatting formula rule:
=SUMPRODUCT(--(MID($A4&" "&$A4,FIND(",",$A4)+2,FIND(",",$A4&" "&$A4,FIND(",",$A4)+2)-FIND(",",$A4)-2)=$B$4:$B$6))

Excel - test one cell string for values from column in another sheet and output the match?

Struggling to find an example or guidance that solves this issue. Hoping someone has an answer.
In one sheet I have a list of transactions. That sheet has a column, "Description", with a bunch of merged values (e.g., "My Name Is Rick"). In another sheet I have a large list of potential values (e.g., Rick, Julie, Jane, John, Sam, etc).
I need to search the cell for any match against the list of values, and I need the return to be the term that matched (e.g., Rick).
All of the solutions I'm finding tend to work the other way around... search an array for the value in a cell.
Appreciate any guidance or help.
Thanks,
Rick

Searching multiple Postcodes in Excel

I have an excel sheet with 8000 records that i would like to search by postcode.
This is my client list and i would like to say search for all clients living in the "EH1","EH2","KY1","SW9" postcodes.
I would like the search to return all the values related to that postcode.
The excel document is laid out like this.
(ID,Name,Surname,Address,Postcode,Telephone Number)
Im a novice at excel spreadsheets so any help on this would be greatly appreciated.
ID Name Surname Address Postcode Telephone number
26584 John Smith 69 Bedford road Eh12 5db 0131225689
Thanks
Edited with quick and dirty method:
If you only need to use this table a few times, then there is a quick and dirty method:
Make a helper column that only includes the first 3 characters of the postcode. You do this via the left function, specifying the postcode column in the first argument, then "3" in the next, to return the first 3 characters. This effectively hides the values you haven't ticked.
You then use the filter section at the top of the column once you have made it a table as stated earlier. In the drop down menu untick "Select all", then tick the values you want to see, i.e. the postcodes you are interested in).
You can then copy the visible cells only via Copy visible cells only if you want to use just that list.
A longer, but more robust method would involve three tables. The first is your data set as it is, with the helper column as discused above included. The second would be a simple single column of all the first three letter codes you are interested in. The third would be an array function modified from this formula:
=index($a$1:$b$7,small(if($a$1:$a$7=$a$10,ROW($a$1:$a$7)),ROW(1:1)),2)
which returns multiple items based on preset criteria, ignoring those that are not specified. I would link to a site explaining this better but I am such a new user I can hardly do anything it seems :(
I suggest you simply use an autofilter on the respective column.
Here is a short tutorial for Excel 2010: AUTOFILTER TUTORIAL
I think an easy way to do this is first make Postcode column first; from Column E to Column A.
Insert a new column in Column A, then use the left function to get the first 3 characters of the postcode: =LEFT(B1,3)
With this, you can use VLOOKUP to search for the postcodes "EH1","EH2","KY1","SW9", and use multiple VLOOKUP formulas to return a column index of everything.
You'll end up with a list of everything for that specific postcode.

how to create new list in excel after comparing duplicates for unique values

I have a excel problem which has been racking my brain.
I have a list of 1740 student names on a master list (ML) and 956 student's names (PT) who took their yearbook photos. I need to compare the two to form a new list (NL) that I can export into a text file to import into a InDesign file for a no-picture list.
Also, the names in J and K are not side by side but might be shifted in some areas. They are also in different cases one is upper and the other is proper. They are also full names [First Last].
I've tried working with if and countif functions with no avail.
I want to do this:
(ML) (PT) (NL)
J K M
1 Alex James Alex
2 James Alex John
3 John Jason Jamie
4 Lexie Lexie
5 Jamie Austin
6 Austin
7 Alex
I need at least a solution that can give me a new list that can be alphabetized eventually by their surname if it requires more steps however if it can be achieved in a single function that would be great.
A single formula that addresses the end requirement might be possible, but it would be a nasty formula indeed. A couple simple formulae and short workflow might suffice:
In a blank column e.g. M2 write formula
=VLOOKUP(J2,K:K,1,FALSE)
and fill down as far as values go in column J. The result will be #N/A wherever there is no match--these are the people with no picture. VLOOKUP will ignore case differences, and the formula doesn't care if the matching name is on a different row.
Since you want to order by surname you will need a way to get that information out of the [First Last] format. In another blank column, write formula
=MID(J2,FIND(" ",J2,1)+1,30)
and again fill down.
The whole thing can now be sorted on two keys: primary on the VLOOKUP column, and secondary on the surname column. The #N/A people will sort to the bottom of the list, making the full names easy to copy off for further processing.
Edit: In pictures:
Step 1: I added surnames because that's the real use case. Note there are two different people named "Alex". Now add the formulae I gave above (shown in red here):
Step 2: Sort the range as described above.
Step 3: The people shaded in green are not in the PT column. We know this because the lookup column returned #N/A. Also, their names are sorted by surname.
Hope this helps to clarify.

Excel Average Questions

So I have to excel sheets. Each sheet looks like this:
Name Value
Bob 1234
Sally 2343
Joe 564564
Essentially I have 300 names and their values. I have a second sheet that has the same names but with different values. I would like to know the easiest way to get the average value for everyone's name across the multiple sheets. I only have two sheets now, but I would like to be able to do it for more in the future.
If the position is the same in all sheets, this is fairly simple:
=AVERAGE( Sheet1!A1, Sheet2!A1, Sheet3!A1 )
or
=AVERAGE( Sheet1:Sheet3!A1 )
However, if the position varies, you'll have to make use of the formulas in the lookup category.
Is Bob on the same row in each sheet? Are there sheets where there is no Bob? Would bob show up multiple times?
Either way, this is something that would probably be more suitable to storing in a database. Excel can still grab things from the DB and display as a spreasheet, but doing average as you want will be far far far easier in a DB.
However, if Excel it has to be, then you'd need to use search functions to find Bob in each worksheet, then get his associated value. =LOOKUP() would probably help for the searching/lookup parts, but you'd still need to do this for every worksheet.
Lets say you have 3 sheets with the same names, in the same position. Insert a 4th sheet where you copy those names. In the results column, type =AVERAGE(Sheet1:Sheet3!A2), and copy that formula down.
Done.
If you plan to add more sheets later, keep a Special sheet that will always remain empty, and make your formula: =AVERAGE(Sheet1:Special!A2).
You will then be able to insert the new sheets BEFORE Special, and your average will need to be edited.
Use an array formula. Enter the following into the first cell replacing 'Bob' with the cell reference for the 'Bob' entry, and hit CTRL+SHIFT+ENTER:
= SUM((name_col2='Bob')*(value_col2))/sum((name_col2='Bob')*1)
There is no easy way in Excel. You have to write VBA code. You need to define all your sheets you need for your calculations go through all the names and put them in an array.
// [Name, Number, Count of Sheets]
[["Bob", 1234, 1], ["Sally", 2343, 1], ...]
For every name in every sheet you need to check if it is included in your array.
If this is the case increase the number and the count otherwise add a new element with [Name, Number, 1]
At the end go through your array and output Name and Number / Count to a new sheet.
You need some basic programming skills.

Resources