I have a large excel sheet that contains duplicates unique numbers, but the information behind each unique number differs. The original sheets needs to be partially copied to a new sheet. The new (master) sheet needs to contain the same unique number, but calculates the total order and tax value. Please see a simplified example below.
Sheet 1
Unique number Product value Tax
1 a $5.00 $1.00
2 b $4.00 $0.75
2 a $7.50 $1.50
3 e $3.00 $0.50
To sheet 2
Unique number value Tax
1 $5.00 $1.00
2 $11.00 $2.25
3 $3.00 $0.50
Any guidance is much appreciated
I did it with the use of a helper column.
So the first thing I did was to generate a list of unique number. I did it with a formula, but there is also a function built into Excel that will do this. The following formula generate a list of unique numbers and places a blank where values are duplicated.
=IF(COUNTIF($A$1:A1,A1)=1,A1,"")
I placed that in the first column of your new table. In the second column of your new table I sorted the list and removed the blank using this formula:
=IFERROR(SMALL($G$1:$G$4,ROW()-ROW($A$1)+1),"")
Then as per ctumturks comment I used sumif as follows:
=IF($H1="","",SUMIF($A$1:$A$4,$H1,C$1:C$4))
That last formula can be copied to the right to sum each subsequent column.
to use the built in function for removing duplicates, select all the unique numbers. Copy and paste them to your new sheet. In your new sheet select the unique numbers again. Go to your Data ribbon at the top. About half way across there is a tool called "Remove duplicates". This will remove duplicate numbers in place and remove spaces at the same time. After you have completed this you should only need the last formula above in the adjacent column.
Related
really need some professional ms excel guru, I'm working in small company HR and we have a list of names of our clients and employees (3000 names give or take) with their salary by the side,
now our management wants to add like say "bonuses" to the salary but don't want to add it directly to it's cell but a column next to the "salary's" column,
I've drawn a chart of basically what I'm talking about, I know it's doable or any way of comparing a list of our employee's name and adding additional columns to the employee's row?
Example Of Workflow
Create a named range by the name of "BonusList", anywhere in the same workbook as the list of salaries. That list should consist of 2 columns, the first of which has the names, the second the bonus.
Use this formula in the column where you want the bonus to appear (the new column).
=IFERROR(VLOOKUP($A3, BonusList,2,FALSE),"")
Make sure that the names are in column A of the salary list. You can change the column, if the names are in another column. Make sure that the row in which you paste the first formula is aligned with the row in the formula (here it is row 3). Copy down.
The formula will display a blank if the name from the salary list isn't found in the bonus list.
I have a table series of tables with 3 columns which record the location of items. Eg table A, A1, A2.... B, B1 etc. etc.:
Each table contains the following columns:
Customer eg. 2. Description and 3. Spec. Number
I recently audited the physical shelves and created the same table alongside the old table in an excel spreadsheet. This new table only has data in the spec. Number column and contains less entries as some of the items on the shelf have been removed. The tables are not aligned on the same rows. i.e. not directly across from each other.
What I would like to do is create a formula to find for example spec number 12345 in the old table and copy the customer and description in the old table which is in the 2 cells to the left of the spec number into the two cells to the left of the new table I have for 12345?
This is fairly complicated but I would think is doable? This is a screen grab of what I am trying to do:
As you can see 4780 was in the shelf when I did the stock take and I only took down the spec. number to be quick. Now I want to copy the customer and print design details over from the 4780 in the table on the left automatically and do this then for the rest of the spreadsheet if possible.
Seems:
=INDEX(B:B,MATCH($J4,$D:$D,0))
met the requirements, copied one cell to the right and both formulae then copied down to suit. OP's image does not show sheet headings, but the positions assumed by the above formula are:
So the formula looks for the J4 value (4780) in ColumnD and if found the MATCH function returns the row number concerned, that then is taken by the INDEX function to determine the relevant cell in ColumnB from which to output the content.
The third parameter in MATCH is 0 to require exact matching only.
The #N/A results could be suppressed by wrapping the formula in IFERROR.
I am trying to find a quick way to assign a value for a column depending on the value of another.I want to increase the value of column A by one each time the value of column B changes.
Column A Column B
1 (520)998-7765
1 (520)998-7765
1 (520)998-7765
2 (450)877-4563
2 (450)877-4563
2 (450)877-4563
2 (450)877-4563
3 (650)989-7654
3 (650)989-7654
3 (650)989-7654
.... ....
I need to know if there is a formula that I can use to sort through 27,000 lines of data rather than assigning them one by one.
I am using a phone number as a unique identifier and I want the ID# to increase by one every time the phone number changes.
Please Help!!
Put value "1" in A2.
In A3 and after put the following function
=IF(B3=B2,A2,A2+1)
EDIT
You can make a single formula for all of the rows.
Put something like this in A2 and copy it down:
=IF(ROW(A2)=2,1,IF(B2=B1,A1,A1+1))
It seems like you are trying to extract the unique list of phone numbers? If so, there is a Remove Duplicates function in Excel (under the Data tab) that should do what you need.
You would select your full range (27,000 phone numbers) and run Remove Duplicates. Excel would then leave behind a single row for each unique number.
I believe Remove Duplicates is available for Excel 2007 or later.
If you are using an older version of Excel, here is a link that gives more information on filtering for a unique list:
Count unique values among duplicates
I need to use a character-based field to obtain a number from a different sheet to be used in a sum with a column from the first sheet.
I have a sheet in google spreadsheet that has the columns:
Vets, number of males, and cost.
I need to have a SUM that will multiply Vets * number of males to provide cost.
BUT the info in vets will be character-based - i.e. Jones, for vet's names - and in another sheet I have a list of vets with the next column having a cost - i.e. 36.77.
I then want to take what is in the cost column of the 2nd sheet and multiply it with the column number of males in the first sheet to give me cost in the first sheet.
Any ideas?!
This FAQ explains how to reference cells from other sheets:
Within a single spreadsheet, you can replicate data and copy it from one sheet to another by entering the sheet name and an exclamation mark before the cell being copied. Here are some examples:
=Sheet1!A1
='Sheet number two'!B4
Is this example something like what you're looking for?
I have data in two columns:
a 1
a 1
a 2
b 3
b 4
In the list there is 4 unique rows. I would like to ad a unique id to each unique row.
Like this:
1 a 1
1 a 1
2 a 2
3 b 3
4 b 4
Of course I have many more rows and columns and date are more complex than in this example.
Anyway to do this i excel?
Mvh Kresten Buch
I have the same issue, I have developed a three formula approach to this. I could probably concatenate it if I nested them, but whatevs, this works.
Assume the data you want to 'number' is in column A, and the first row of the table is row 3.
The first column (in column B) counts occurrences of the 'value' and the range expands from the top of the table downwards as the table grows:
=COUNTIF($A$3:A3,A3)
the second column's formula also expands as the row count does, and simply adds 1 to the transaction count every time it encounters a 1 (ie first occurrence of a new unique value) in column B
=IF(B3=1,MAX($C$2:C2)+1,"")
This one worked for me even in the first row of the table btw - i was expecting to have to manually input a 1 to start the list. Having it work without the manual entry is a good thing, it means the formmulas all work even if you resort the table data into a different order.
The third one in column D uses a vlookup to find the value. Note that when vlookup finds more than one number, it always pulls the first occurrence.
=VLOOKUP(A3,$A$3:C3,3,FALSE)
Note that this will renumber all the data outcomes dynamically if you do resort the entire thing. ie the formulas all work, but the number 'assigned' to a praticular set of data might be different, as it all works from whatever order the list of items is in.
My use case for these formulas assumes that every month i paste a new set of data to the bottom of the table, some items of which are repeats from previous months - ie are already in the table, and some of which are new.
if the dynamic renumbering is a problem, use a 'row key' so you can resort back to the original order at the end.
Assuming your data is in B2:C6 please try =IF(AND(B1=B2,C1=C2),A1,A1+1) in A2, copied down
If your data is not sorted, it's more complicated... but you can use something like this in A2:
=IF(COUNTIFS($B$1:B2,B2,$C$1:C2,C2)>1,INDEX($A$1:A1,IFERROR(MATCH(B2&"-"&C2,$B$1:B1&"-"&$C$1:C1,0),1)),MAX($A$1:A1)+1)
I'm assuming that there are no headers and you have already put 1 in cell A1 for the first record.
It basically checks the whole columns above the formula and if there's already a similar record, it'll assign the previously given unique ID and if not, it'll give a new ID.
This is an array function and as such will work if you use Ctrl+Shift+Enter and not Enter alone.
The IFERROR() is there because MATCH(B2&"-"&C2,$B$1:B1&"-"&$C$1:C1,0) would return an error if it is on row 2 (the first record to check).
Once you put that in the first cell, you can fill down the formula.
I deal with this issue all the time when structuring a data set into panel data. say you have multiple columns of data, and each are unique based on the name of someone, like:
ANNE
ROSE
ANNE
FRANK
TOM
ROSE
ANNE
but instead of having each column related to Anne, Rose, Frank, or Tom, you want it to look like this:
1 ANNE
2 ROSE
1 ANNE
3 FRANK
4 TOM
2 ROSE
1 ANNE
So that each name now has a unique numerical identifier that can be used in place of the name.
Make a pivot table of your data and only place the column that has the names (or whatever the identifier may be) into the Rows section. This will single out all the different names used within the dataset. Copy and paste this pivot table anywhere on the sheet so that the names are in actual cells and not off of a pivot table. To the right of the names, enter 1 next to the first name, and then =B1+1, and so on so that you number each name with a unique value; then copy and paste this column as numbers so that their formulas are erased. Finally, just go to your original dataset and perform a VLOOKUP so that the names get attached with whatever unique value was assigned off of the pivot table. Make sure to copy and paste as numbers once done to remove the VLOOKUP formula.
Takes literally 2 minutes to do, depending on size of dataset, and is very easy. It will work perfectly every time.