concatenating two part-words together - excel

I am helping someone with their wedding and i am using excel for the table plans for their dinner.
When i originally set this up, i was stupid enough to make two people, not as a couple, but as individual people.
So i have mr person and mrs person.
Now i want to make these two individuals into one cell row in excel.
i.e. before; | mr person | 72 land lane | 1234-5678.
And mrs person | 72 land lane | 1234-5678.
How would i make it so that it would be | mr & mrs person | 72 land lane | 1234-5678 | ?
P.s. some people on the list are singles! so i cant find and replace, to add a mrs part to each person!

Assuming your name, address and phone number are in different columns I'd use a COUNTIF statement in Column D to identify those at the same address (assuming they all live together!) You'll need to adjust the range, and insert a blank column into Column A.
=IF(COUNTIF($C$2:$C$9,C2)>1,"Mr & "& C2,"")
This will concatenate all the couples, you can then use the below formula in a different column to identify the partner to be deleted:
=IF(LEFT(C2,8)="Mr & Mr ","DELETE","")

Related

Excel VBA for Data Cleaning

I want to find a way to automate our data cleaning (de-duping) process using excel VBA. Currently, our team gets a patient list from the clinics to de-dup since we find variations of duplicate records.
The reports we get from the clinic comes in an excel spreadsheet. We use specific columns of information from the spreadsheet we receive since we do not need everything from there. I've used multiple functions to remove duplicates since the patient records are entered manually, so there's a lot of different ways you'll see in the list.
It's okay if they have different addresses and insurance info because people move and they switch insurances. The conditions we focus on is whether someone has the same date of birth and first name and last name. We're not too strict on the last name either because last names change. In this case, we make sure that their date of birth is the same, first name is the same, and the address. We need at least three elements the same to consider that these are the same person, or we'll say these are different people and leave the records alone.
The list we work consist of the following columns:
First name, last name, DOB, Address, City, State, Zip, Primary Insurance.
| First Name | Last Name | DOB | Address | City | State | Zip | Primary Insurance |
|------------|-----------|--------------|------------------|----------|------------|--------|--------------------|
| John | Smith | 01/01/1990 | 123 ABC Street | Denver | Colorado | 87880 | Humana Insurance |
| Jon | Smith | 01/01/1990 | 123 ABC Street | Denver | Colorado | 87880 | Humana Insurance |
| Anthony | Bowen | 02/02/1992 | 456 ABC Street | Austin | Texas | 78632 | Aetna |
| Tony | Bowen | 02/02/1992 | 456 ACC Str | Austin | Texas | 78632 | Aetna |
Currently I sort the entire sheet of data from DOB oldest to newest, first name a-z, last name a-z.
From there I apply a formula:
if(and(C2=C3, B2=B3, A2=A3),"Check","") and apply through the entire rows. I filter all the blank cells to remove the formulas embedded and un-filter to jump down to the next cell that is flagged down with "Check" and check the next two rows.
I spot check to make sure the formula is picking all the true duplicates and then filter to see all the "Check" and remove all rows at the same time.
Then I move on to applying another formula:
if(and(C2=C3,left(B2,2)=left(B3,3),left(A2,2)=left(A3,2)),"Check","")
This is to match by same DOB, first two letters of first name and last name. Same process by jumping down to the next row that is flagged down with "Check" to review the two consecutive rows.
Again, spot check to make sure they're true duplicates, then filter to see all "check" and mass delete.
I would like to do this by having macro embedded buttons and the button will help grab the flagged down records to another tab of worksheet and removing those duplicated records from the original working sheet. So this way, it's removed from the original list but the user can still go to the other tab to review those removed duplicates if they want to.
I'd appreciate any suggestions anyone can give.
Thank you!

Total points for each student in Google spreadsheet or excel

I am in the process of creating a Google form, which students will fill out after attending an event. Based on the event they attend, I will be assigning points to them and this form can be submitted through the whole year.
Is there a way to get a total number of points for each students, since they'll be submitting the form multiple times, I need a way to tally up the points for each students
Example spreadsheet goo.gl/1aunYg
Sam | 2
Jon | 2
Mike | 2
Don | 2
Sam | 3
Sam | 1
Jon | 2
Mike | 1
Total for Sam: ???
Total for Jon: ???
Total for Mike: ???
Total for Don: ???
In google spreadsheets, assuming you have the names in Col A and the scores in Col B, you can also try:
=query(A2:B; "select A, sum(B) where A <>'' group by A label sum(B) 'Totals' ")
This should output an array of unique names and the summed scores.
Sort the list on Name (Home>Sort & Filter)
Add a heading for the columns
Apply SubTotals (Data>Subtotal in the Outline group) at each change in Name and using the function Sum.
You can then hide/show individuals using the controls on the LH side.
Google Spreadsheet see SUMIF
In Excel you could do something like ...

Look for multiple occurences of text (partial match)

I am struggling to solve the below problem:
I have a list of users who have attended various numbers of courses. Now I want to find which courses each person has attended and list them in a new sheet. Below is a picture of my sheet:
Names | Courses
--------------------------------------------------------------------------------------
Farnaz Hossein Zadeh, Elena Pak, Mehran Behzadi, Atefeh Ghorbani, John Smith | AP01
John Smith, Farnaz Hossein Zadeh, Tom green | AP03
John Smith | AP05
And I need to get:
F G H
Farnaz Hossein Zadeh AP01 AP03
As far as I know, this is not quite possible with Excel formulas alone.
First, you need to clean up your data. Your can use Data > Text to columns to separate the comma-separated data. Then, make that data vertical so that you effectively have a list of pairs course-student. Then you can list unique courses by doing a pivot table on your data.

In Excel, how can I use a formula to merge rows with common values and concatenate differences?

Using the example from this question:
Excel - Merge rows with common values and concatenate the differences in one column
How can I change:
Customer Name | NEW YORK | ALBANY
Customer Name | NEW YORK | CLINTON
Customer Name | NEW YORK | COLUMBIA
Customer Name | NEW YORK | DELAWARE
Customer Name | NEW YORK | DUTCHESS
Customer Name | VERMONT | BENNINGTON
Customer Name | VERMONT | CALEDONIA
Customer Name | VERMONT | CHITTENDEN
Customer Name | VERMONT | ESSEX
Customer Name | VERMONT | FRANKLIN
to this:
Customer Name | VERMONT | BENNINGTON,CALEDONIA,CHITTENDEN,ESSEX,FRANKLIN
Customer Name | NEW YORK | ALBANY,CLINTON,COLUMBIA,DELAWARE,DUTCHESS
where | denotes a cell. The answer given in the question above was for a macro. I need to create a manageable template and most people do not know how to manage macros. Thus, I need a formula to do this. Can anyone help out?
If your data is sorted by state, you can use a formula column and a helper column to make it simple. First column, you concatenate the states
in D2:
=if(B2=B1,D1&C2&",",C2&",")
in the second column, you can put a filter that tells you if the list is finished
=if(B2=B1,"","State Complete")
You can filter on the State Complete value and get your results.
If you're trying to go a lot more fancy than that, you'll need macros or user-defined functions.
Similar but a singe formula (and a 'wheeze'), assuming ALBANY is in C2, etc:
=IF(B1=B2,D1&","&C2,C2)&IF(B2<>B3,".","")
The full stop (period) is to identify the last of each set (which are assumed to be sorted and for ColumnC TRIMmed if necessary - also assumes no full stops in Column C).
A formula will not delete rows so either filter to select rows with cells containing full stops or copy the column, Paste Special Values over the top, filter and delete those not containing a full stop. I'd prefer the latter as presumably ColumnC itself should be deleted.
The periods could be removed with Find and Replace.

Report generation based on multi lookup and dynamic columns

I am a little stuck with a report I am trying to generate in Excel and was hoping someone could help.
Here is a summary of what I am trying to do:
Table 1 has one column called people (it’s basically a list of
employees)
Table 2 has one column called countries (it’s basically a
list of relevant countries)
Table 3 has three columns called person,
country and date.
There is one entry for every person each time they review a country.
So the data will look something like:
PERSON | COUNTRY | DATE
John | uk | 10/01/2013
Paul | uk | 15/01/2013
John | France | 15/01/2013
Bob | Spain | 16/01/2013
The report I need to produce is one which shows who has/hasn't checked each country.
So the columns will be ‘Person’, uk, France, Spain (and any other unique value from the country table).
There will then be one single row for each person with a Yes/No value in the relevant column if that person has reviewed that country i.e. Table 3 contains a value that matches that value for the person and country.
So to be clear the report should be similar to:
PERSON | UK | FRANCE | SPAIN
John | Yes | Yes | No
Paul | Yes | No | No
Bob | No | No | Yes
In summary I can split this into two problems:
How to generate a table that has a column for every unique value in another table (country in the explanation above)
How to do a double lookup i.e. IF EXISTS in TABLE 3 ‘person’=john & ‘country’=uk then return ‘Yes’, otherwise return ‘No’
I’m happy to keep in Excel or make use of SQL reporting i.e move my data to SQL first.
It's kind of a wonky formula but =sumproduct() will do a dual lookup.
=IF(SUMPRODUCT(--($K$2:$K$5=$K13), --($L$2:$L$5=M$10)),"Yes","No")
The Person/Country/Date table is located in the range K1:M5 the results table is located in range K10:N13. I had a workbook open and put it in the corner. (Nobody puts sumproduct in the corner)
The gist is, -- turns a true and false into a 1 or 0. sumproduct will multiply the two results line by line. If both are true, you get 1 x 1 and funnels that back into the if for a yes and no. You'll have to be mindful of th $ in the formula.

Resources