Another Excel Question

URI

stands for life, liberty and the uturian way of li
Moderator
SoSH Member
Aug 18, 2001
10,329
Right now, I'm working on a prospect list, which has a column for:

Events - Seats - Account# - Name - Address - City - Zip - Phone - Email address.

Now, the issue is that I need to keep this information, but sometimes people buy tickets to more than one game, so there are duplicates all through this list.

Is there an easy way I can take the dupes out?
 

URI

stands for life, liberty and the uturian way of li
Moderator
SoSH Member
Aug 18, 2001
10,329
QUOTE (behindthepen @ May 5 2010, 12:42 PM) index.php?act=findpost&pid=2947847
the simplest way is probably the subtotal function. which version of excel are you using?


03
 

MannysDestination

is not a republican
SoSH Member
Nov 15, 2006
10,785
Boston
Pivot table. Have each of the columns be the field listed except for events and tickets, which can be displayed as sums. The wizard should get you most of the way there.
 

URI

stands for life, liberty and the uturian way of li
Moderator
SoSH Member
Aug 18, 2001
10,329
Looks like the pivot table option is too unwieldy, unless someone wants to walk my retarded ass through how to do this.
 

Red Right Ankle

Formerly the Story of Your Red Right Ankle
SoSH Member
Jul 2, 2006
11,978
Multivac
QUOTE (URI @ May 5 2010, 01:18 PM) index.php?act=findpost&pid=2947915
Looks like the pivot table option is too unwieldy, unless someone wants to walk my retarded ass through how to do this.


Which version of excel do you have? 07 actually has a remove duplicates button on the Data tab. Otherwise, PM me and I'll walk you through it.
 

behindthepen

Well-Known Member
Lifetime Member
SoSH Member
Mar 26, 2005
6,236
Section 41
QUOTE (URI @ May 5 2010, 01:18 PM) index.php?act=findpost&pid=2947915
Looks like the pivot table option is too unwieldy, unless someone wants to walk my retarded ass through how to do this.

Sort the table by Name. (or ACCT#)
Then highlight all the data, and click DATA/SUBTOTALS.
-At each change in NAME (or ACCT#)
-SUM
-Add subtotal to SEATS

You'll get a total row for each NAME/ACCT#, and then you can click on that row to expand and see the details.
 

GreenMonster49

Well-Known Member
Silver Supporter
SoSH Member
Jul 18, 2005
649
This might be answered already, but if you have labels on top of the range of data, you can use Data/Filter/Advanced/Unique Values Only to filter out exact duplicates. If only some fields are duplicates, then you will need to copy the appropriate columns elsewhere and then do the Data/Filter/Advanced/Unique trick.
 

Nite Vizhun UV

proctological researcher
SoSH Member
Aug 30, 2002
4,646
Shakedown Street
Figured I'd bump this thread rather than start a new one...

I'm creating a report in Excel using pivot tables.

I am transposing results from one tab to another. I have about 75 pivot tables, each with results for grades 5-12. I can click on the first cell in a row on the second tab and set it equal to the appropriate cell from the first tab. What I want to be able to do is put the cursor at the bottom-right corner of the cell that has the data for 5th graders (on the second tab) and drag it across the row to populate data for 6-12 graders. Unfortunately when I do that, the formula doesn't increment the way I want it to. I think it's because I'm trying to transpose the data from a column to a row on the second tab.

Here's the formula: ='Grade %'!$J45

I put a '$' in front of the 'J' because all the data is in the 'J' column. I want the '45' to increment to '46', '47', etc. Is there an escape character I can put in front of the '45' to force it to increment by one for each cell I drag it to?
 

EddieYost

is not associated in any way with GHoff
SoSH Member
Jul 15, 2005
10,750
NH
Figured I'd bump this thread rather than start a new one...

I'm creating a report in Excel using pivot tables.

I am transposing results from one tab to another. I have about 75 pivot tables, each with results for grades 5-12. I can click on the first cell in a row on the second tab and set it equal to the appropriate cell from the first tab. What I want to be able to do is put the cursor at the bottom-right corner of the cell that has the data for 5th graders (on the second tab) and drag it across the row to populate data for 6-12 graders. Unfortunately when I do that, the formula doesn't increment the way I want it to. I think it's because I'm trying to transpose the data from a column to a row on the second tab.

Here's the formula: ='Grade %'!$J45

I put a ' in front of the 'J' because all the data is in the 'J' column. I want the '45' to increment to '46', '47', etc. Is there an escape character I can put in front of the '45' to force it to increment by one for each cell I drag it to?
Usually in Excel, if you do 2 cells manually in a row, it will figure out the pattern. So do another cell like this: 'Grade %'!$J46 Then highlight both and drag the corner.
 

Jim Ed Rice in HOF

Red-headed Skrub child
SoSH Member
Jul 21, 2005
8,357
Seacoast NH
Usually in Excel, if you do 2 cells manually in a row, it will figure out the pattern. So do another cell like this: 'Grade %'!$J46 Then highlight both and drag the corner.
Still stuck with 03 Excel here at work but I think that may just set up a recurring paste of $j45 and $j46 (that's what it did when I tried that option).

If the perfect solution doesn't appear, you can try this slightly longer work around:

Drag the cell down instead of across to fill the range of formulas. Copy from the second formula till the end, go to the cell next to the original $j45 formula then choose paste special and click on "formulas" and "transpose". They will then be lined up horizontally and you can delete the vertical formulas.
 

EddieYost

is not associated in any way with GHoff
SoSH Member
Jul 15, 2005
10,750
NH
I think I understand better now. I was thinking of vertical filling before. When I tried it horizontally, with references to another cell, it did what you said (recurring paste). So here is what I did. Temporarily get rid of the = and page reference. Make your first two cells be J45 and J46 (literal strings). Then do the drag and you should see the pattern that you want. Then highlight all of those cells and do Ctrl-H. Now replace J with ='Grade %'!$J for that entire range, and it should work.
 

Nite Vizhun UV

proctological researcher
SoSH Member
Aug 30, 2002
4,646
Shakedown Street
I think I understand better now. I was thinking of vertical filling before. When I tried it horizontally, with references to another cell, it did what you said (recurring paste). So here is what I did. Temporarily get rid of the = and page reference. Make your first two cells be J45 and J46 (literal strings). Then do the drag and you should see the pattern that you want. Then highlight all of those cells and do Ctrl-H. Now replace J with ='Grade %'!$J for that entire range, and it should work.
Perfect, works like a charm. Damn, I should have been able to figure that out, I love using Replace All to great effect. Thanks!
 

BroodsSexton

Member
SoSH Member
Feb 4, 2006
12,647
guam
I'm sure there's a simple way to do this in excel, but I'm not very good at it, and my attempts at tech-support by google have failed.

I want to count the number of rows in a sheet where one column has one condition (i.e., is blank, or contains a certain word) and another column has a different condition (i.e., is not blank or has a different word).

Any help?
 

Morgan's Magic Snowplow

Member
SoSH Member
Jul 2, 2006
22,378
Philadelphia
I'm sure there's a simple way to do this in excel, but I'm not very good at it, and my attempts at tech-support by google have failed.

I want to count the number of rows in a sheet where one column has one condition (i.e., is blank, or contains a certain word) and another column has a different condition (i.e., is not blank or has a different word).

Any help?
I'm not an excel master but let me take a shot. Assume a simple situation in which you have two columns A and B with various entries. Make a new column C with code like this:

=IF(AND(A1="Brood", B1="Sexton"),1,0)

In simple terms this code says: "If the word in column A is "Brood" and the word in column B is "Sexton", then put a 1 in the new column C, and if those conditions don't hold put a 0 in column C." Then you can just sum all the 1s in column C to get a total of how many rows satisfy these conditions.

If you want to reference two blank columns rather than two words, then the code would look like =IF(AND(A1="", B1=""),1,0)
 

BroodsSexton

Member
SoSH Member
Feb 4, 2006
12,647
guam
Yeah, that should work nicely, thanks. Need to think out of the box, rather than just look for a magic bullet function...
Now a real basic question: What about 'any text'? In other words what if I don't want to see if A1 has "Broods," but rather anything at all -- not blank.
 

Morgan's Magic Snowplow

Member
SoSH Member
Jul 2, 2006
22,378
Philadelphia
Yeah, that should work nicely, thanks. Need to think out of the box, rather than just look for a magic bullet function...
Now a real basic question: What about 'any text'? In other words what if I don't want to see if A1 has "Broods," but rather anything at all -- not blank.
Use the not equal sign, <>, and construct the statement "if A1 not equal to blank."

=IF(AND(A1,<>"", B1="Sexton"),1,0)
 

BroodsSexton

Member
SoSH Member
Feb 4, 2006
12,647
guam
[quote name='Morgan's Magic Snowplow' timestamp='1310920074' post='3636163']
Use the not equal sign, <>, and construct the statement "if A1 not equal to blank."

=IF(AND(A1,<>"", B1="Sexton"),1,0)
[/quote]
Lovely. Thanks for the help.
 

mt8thsw9th

anti-SoSHal
SoSH Member
Jul 17, 2005
17,121
Brooklyn
I know we used to have a catch-all Excel thread, but I can't find it. So...

Anyhow, what I'm looking to do is the following:

Spreadsheet #1 has two fields: Project # and Write-off Amount

Spreadsheet #2 has the complete project listing

Spreadsheet #3 has the logic that the write-offs should follow, i.e., if $X, pull the appropriate project contacts from Spreadsheet #2

In #1 User enters the project code into the first field, and the write-off total into the second, and what should happen is using the logic in #3 (for example, $21,000 pull names from column B, C, and D; if $500 pull names from B and C)

Am I explaining this well enough? Is this feasible?
 

tonyandpals

Well-Known Member
Lifetime Member
SoSH Member
Mar 18, 2004
7,860
Burlington
crow is right, unless you know the write off amounts are unique. Are the values being pulled in some type of approvals based on the amount of the write off? If that's the case, maybe it can work this way. If not, you're going to need a column C that contains some type of unique identifier to vlookup the information you want from the 3rd sheet.
 

Billy Jo Robidoux

Shoveltowner/Jerkface
SoSH Member
Jan 6, 2003
2,865
Cape Cod
So depending on what gets entered in the write-off field, some logic is applied from sheet 3, and then what is supposed to happen? Names get pulled from certain columns -- in which sheet?

It's definitely feasible, but I need some more info.
 

Murderer's Crow

Dragon Wangler 216
SoSH Member
Jul 15, 2005
23,543
Garden City
I would sort by price, have the conditional format identify the duplicates, and then figure out a unique identifier that you can concatenate onto the price field.
 

mt8thsw9th

anti-SoSHal
SoSH Member
Jul 17, 2005
17,121
Brooklyn
I'm confused. Are you searching using price? Wouldn't, theoretically, you have duplicates?
No, the total write-off amount determines which parameters to pull. It could be any number from $1 to $1 million+. However, the ranges $500-$2500, $2501-$5000, and so on will each pull different results. Let's say project 12345 needs the write-off, if it's $555 it will pull the name from just column A; if it is $3,050, it will pull from A and B.

Entering the project number should isolate whichever row from the project list matches that project #, and the write-off figure will determine which columns' data needs to be pulled.

Sorry if I'm being too vague or ambiguous.
 

Corsi

isn't shy about blowing his wad early
Lifetime Member
SoSH Member
Dec 3, 2010
12,955
Boston, MA
No, the total write-off amount determines which parameters to pull. It could be any number from $1 to $1 million+. However, the ranges $500-$2500, $2501-$5000, and so on will each pull different results. Let's say project 12345 needs the write-off, if it's $555 it will pull the name from just column A; if it is $3,050, it will pull from A and B.

Entering the project number should isolate whichever row from the project list matches that project #, and the write-off figure will determine which columns' data needs to be pulled.

Sorry if I'm being too vague or ambiguous.
On Worksheet #1, I'd add a new column with an If statement (i.e. =IF(AND(A1>0,A1<150),1,IF(AND(A1>4,20<9),2, etc, etc....). In this formula, put in the criteria for what to return if the value in cell A1 is above/below a certain threshold, or reference the cells with this information from Worksheet #3.

Since you have the logic on #3, the formula would be something like =IF(AND(A1>0,A1<150),Worksheet #3 Cell with Contact Info,IF(AND(A1>4,20<9),Worksheet #3 Cell with Contact Info, etc, etc...
 

mt8thsw9th

anti-SoSHal
SoSH Member
Jul 17, 2005
17,121
Brooklyn
Alright, so that works in identifying the contacts, but the tough part is getting it so Excel is looking for the proper row, e.g., project 12345 is in row 114, so it's this bit:

=IF(AND(A4>499),projects!O2

How could I have it searching for the proper row based on what is entered for the project code?

Sorry if these are stupid questions. I'd normally have the IT group help with this sort of thing, but we receive zero help due to resource allocation issues.
 

Corsi

isn't shy about blowing his wad early
Lifetime Member
SoSH Member
Dec 3, 2010
12,955
Boston, MA
Alright, so that works in identifying the contacts, but the tough part is getting it so Excel is looking for the proper row, e.g., project 12345 is in row 114, so it's this bit:

=IF(AND(A4>499),projects!O2

How could I have it searching for the proper row based on what is entered for the project code?

Sorry if these are stupid questions. I'd normally have the IT group help with this sort of thing, but we receive zero help due to resource allocation issues.
What value are you looking to have returned based on the user typing in the project code?

In any event, I'd add another sheet (#4) with your lookup values. Have one column be all the project codes and the next column be whatever value you want returned.
 

jayhoz

Ronald Bartel
SoSH Member
Jul 19, 2005
17,397
You need to somehow nest some vlookups inside the IF statement. Can anyone confirm if that is doable? For each Writeoff criteria you need the formula to use a vlookup to return the correct names.


=VLOOKUP(lookup_value, table_array, col_index_num, FALSE])

lookup_value = Cell in spreadsheet one with Project number
table_array = name you give to full range of data in Spreadsheet 2

col_index_num = The column number (count from left to right) that has the name of the contact that should be returned for this writeoff value
Spreadsheet #2 must have the project numbers in the leftmost column.



In English what this says is take the project number I just typed in (lookup_value) and find it in spreasheet #2 (table_array). Now go to the Xth column (col_index_num) and put the name of the contact you find there in this cell. Only return exact matches for the project number I just typed (FALSE).
 

mt8thsw9th

anti-SoSHal
SoSH Member
Jul 17, 2005
17,121
Brooklyn
Alright, I tried that and hit a roadblock.

So I eventually figured out the easiest way to do this:

I used a Vlookup to populate the project information in sheet 1 (white text in locked cells), and used IF to determine which values to show based on the user inputs of Project and Write-off.

Anyhow, thanks for the input everyone, as it took some troubleshooting to get everything in order.
 

mt8thsw9th

anti-SoSHal
SoSH Member
Jul 17, 2005
17,121
Brooklyn
So I'm trying to populate column KQ in a sheet based on what is in column A, and the table array is in 'Sheet1'. If there is a match in 'Sheet1' from what is in column A in my main worksheet, then it should populate column C with this info. I keep getting a #N/A error when trying to pull this info. 
 
This is the formula:
 
=VLOOKUP(A5,Sheet1!$A$2:$B$295,2,FALSE)
 
Little help? I swear I always royally fuck these up. 
 

Bergs

funky and cold
SoSH Member
Jul 22, 2005
21,695
mt8thsw9th said:
So I'm trying to populate column KQ in a sheet based on what is in column A, and the table array is in 'Sheet1'. If there is a match in 'Sheet1' from what is in column A in my main worksheet, then it should populate column C with this info. I keep getting a #N/A error when trying to pull this info. 
 
This is the formula:
 
=VLOOKUP(A5,Sheet1!$A$2:$B$295,2,FALSE)
 
Little help? I swear I always royally fuck these up. 
 
 
The formula is fine provided there's no data deeper than row 295 on Sheet1
 
I'm guessing your problem is formatting. First thing, manually find whatever is in A5 in column A of sheet1. Are there leading spaces? is one a number formatted as text?
 

OttoC

Member
SoSH Member
Dec 2, 2003
7,353
Sometimes VLOOKUP fails because your data has leading or trailing spaces. You ask it to find "AB" when the data is actually in the form "AB ". This can happen when you copy from another source.
 
TRIM() although I use an free add-on to Excel called ASAP Utilities that contains a lot of useful things.
 

Bergs

funky and cold
SoSH Member
Jul 22, 2005
21,695
Bergs said:
The formula is fine provided there's no data deeper than row 295 on Sheet1
 
I'm guessing your problem is formatting. First thing, manually find whatever is in A5 in column A of sheet1. Are there leading spaces? is one a number formatted as text?
 
 
OttoC said:
Sometimes VLOOKUP fails because your data has leading or trailing spaces. You ask it to find "AB" when the data is actually in the form "AB ". This can happen when you copy from another source.
 
TRIM() although I use an free add-on to Excel called ASAP Utilities that contains a lot of useful things.
 
 
Otto! Come on, man!!!!
 

mt8thsw9th

anti-SoSHal
SoSH Member
Jul 17, 2005
17,121
Brooklyn
Alright, thanks. It turns out it was a formatting issue from the other doc I was using. The problem got worse when I found out the data I was looking for wasn't just in columns G&H, there were other numbers I needed to pull in J-S (each taking up two columns Dept ID and Dept Name), so that was a problem I had no solution for, so I had to pull everything manually.
 

tonyandpals

Well-Known Member
Lifetime Member
SoSH Member
Mar 18, 2004
7,860
Burlington
Sometimes you need to format the column in both to match.  But not using the typical format... I don't know why. But I trick it by doing a text to column on the column I want to format, and set them both to general (without parsing it to separate columns, just for the formatting).
 

mt8thsw9th

anti-SoSHal
SoSH Member
Jul 17, 2005
17,121
Brooklyn
So there's something I've discovered since struggling with the ever-temperamental VLOOKUP, and it's the much more awesome Index Match. There has not been a single thing that I've wanted to instead use a VLOOKUP for since stumbling upon the magic of Index/Match. I mean, they might be common knowledge, but in my travels it was always vlookup, vlookup, vlookup. So question to those more knowledgeable than me, what am I missing out on when pretty much abandoning the vlookup?
 
I love the simplicty - =index(sheet2!A:A,match(A2,sheet2!B:B,0)).-  you're simply asking, please give me a value in the column that I'm looking for, and the way you find it is take the value in cell A2, find it in the second sheet's column B, and return the value in that sheet's column A.
 
And at work, a multiple-criteria index/match just allowed me in 10 minutes to do something that was taking two people days to do (though I won't act surprised when I discover all these examples of inefficiency across our economy). 
 
 
So, this somewhat segues into the next project I've started at work: quick background, I work at a reasonably large hospital in the Boston area, and we are doing a lot of testing which requires test patients - the software vendor doesn't have a tool to create them, nor does our PM firm - so I ended up figuring out how to put together a workbook that will allow someone to simply type in the naming convention of the test patients, and the number that are needed, and it populates every field that will satisfy a complete patient record in the system (save for two items that aren't generated until post-registration). One will then copy and paste the values into the import file, generate the txt file required, and load it into the system. No trudging through all of the registration screens is required.
 
That's all well and good, but I'm adamant of having a process flow being as absolutely efficient as possible, i.e., remove all of the steps that someone could fuck up along the line. So the solution I've come up with in regards to this workbook is taking the copy/paste values bit out of the equations, and having the values auto-populate into the import spreadsheet. The sheet is macro-enabled, and will only export values within the columns and rows bounded by cells filled with black. Getting the values to populate into the import spreadsheet is the easy part, but I'm looking for a formula that will say:
 
Sheet1  |    Import
 
A2   X        (value Sheet1)                 
B2   X         (value Sheet1)
C2              if C2 is blank, then fill cell with black
 
naturally, it would be something like =IF(Sheet1!C2="",(fill with black),Sheet1!C2)
 
TL;DR version:
 
How do I get the cell to fill with black?
 
I'm searching up and down on Google, and the major issue seems to be that Microsoft decided to name two different things in excel "fill".
 
And I'm now realizing the answer if probably conditional formatting, but I have to test if that works when a formula says to ="".
 

mt8thsw9th

anti-SoSHal
SoSH Member
Jul 17, 2005
17,121
Brooklyn
Yes, that was my thought...but it turns out that is a bit too simple. The import file does need the import values surrounded by cells that fill with black, but that alone doesn't cut it - in order for the macro to work, the comment #LAST_ROW needs to be in the first first cell after the last row of data. So it's back to the drawing board, but hopefully it's not too tough a fix...I miss when figuring out how to fill a cell with color was my main problem...
 
Edit - And the solution would be to have the import spreadsheet set up like
=IF(A1="",N(#LAST_ROW),Sheet1!A1))
 
That would insert a comment with that info in theory, but the indicator value makes the formula error.
 
last edit - it turns out what I was taught about the macro is all wrong. The black border does nothing except to alert the user where they should be inserting data, as inserting extra lines if there are 10 open rows, and 20 rows of values would cause you to have 9 rows of data falling past the #LAST_ROW indicator, and one overlapping it. The only thing that matters is that #LAST_ROW indicator. It could be in row 10,000, as all the macro will pull are populated rows. I was told 1 array=black band in the next row, when that made no difference. It worked because of the comment.
 
To harken back to a bit from my TL;DR, stream of consciousness posts, I am now doing my best to not be shocked by just how little the vendor (who taught people at my company how to use this tool) knew about how it actually worked.
 
Cool story, etc.