|
hog wizard posted:Like many of us, I have to work on Excel spreadsheets all day. I can do a lot of the basic and intermediate functions but I need help automating a process that I do to make my work a lot more efficient. Seems fairly straightforward. The code logic isn't too complex, you've essentially laid it out above, so the only barrier is knowing the specific code snippets you need. You can do almost everything you need with Cell operations. Once you add a drop down and format it with your client data range, you can go to "view code", and a code:
The Cells() function will do mostly everything you need (although you can also use Rows()). Define your worksheets as objects in the beginning to make messing with them easier: code:
An example of a simple cell transfer from sheet to sheet using the above definitions: code:
|
# ? Jan 12, 2012 19:32 |
|
|
# ? May 11, 2024 11:24 |
|
^^^^If you are sharing this file with others and they are scared whenever the macro security bar appears, you can do it with functions. hog wizard, I am assuming your client name dropdown is in Report!$C$1 then in your "Client Information" table you would want to have code:
code:
Old James fucked around with this message at 23:41 on Jan 12, 2012 |
# ? Jan 12, 2012 20:44 |
|
Powdered Toast Man posted:Having trouble with a sheet that is pulling from an external data source. Some details: I don't work with database connections very often, but doesn't the end user have to have the database connection in their "My Data Sources" folder on Windows as well as the associated driver in order to do the refresh data? Maybe the end user machine where you are running it is missing the data source file. Powdered Toast Man posted:EDIT: I think that means this...
|
# ? Jan 12, 2012 20:55 |
|
Old James posted:I don't work with database connections very often, but doesn't the end user have to have the database connection in their "My Data Sources" folder on Windows as well as the associated driver in order to do the refresh data? Maybe the end user machine where you are running it is missing the data source file. I'll check into this, thanks. I believe he was looking in ODBC for the connection. Thank you as well for the screenshot. The table design tools are not showing up when we make the selection in this file for some reason. Dunno what's up with that.
|
# ? Jan 12, 2012 21:15 |
|
DukAmok and Old James, thank you for those replies. They were very helpful. I really appreciate it. Old James, it seems like if any of the cells next to the client name is blank, then it returns a value of 0. Is there a way I can make it return a blank?
|
# ? Jan 12, 2012 23:06 |
|
hog wizard posted:DukAmok and Old James, thank you for those replies. They were very helpful. I really appreciate it. Ah yes, if the cell is blank the offset formula returns 0. The versions below check to see if the cell is blank and return a blank value, whereas if the cell legitimately has a value of 0 of will still return 0. code:
|
# ? Jan 12, 2012 23:38 |
|
Hopefully this is dead simple, I just don't know what to search for - I have two spreadsheets with ID numbers, names, and departments. One sheet has all the right departments, the other sheet has the same placeholder department for every person. The sheets vary in how many times a person is listed so I can't just do a straight sort and copy type of thing. How can I get all the departments into the other sheet? Example: Sheet 1 code:
code:
|
# ? Jan 12, 2012 23:54 |
|
beejay posted:stuff... Sounds like a vlookup is in your future. code:
|
# ? Jan 13, 2012 00:02 |
|
Fantastic. Thank you, Old James.
|
# ? Jan 13, 2012 00:05 |
|
Vlookup is working fine for this. Thank you. I'm gonna need to take a class I think at some point to brush up.
|
# ? Jan 13, 2012 18:30 |
|
One small question: I have a sheet where I roll 6 six-sided dice in pairs of 3. Basically a bunch of RANDBETWEEN(1:6) Now, I want to pick out the highest of the pairs (MAX=cell1:cell3) and if two or more "dice"/cells equals "6", then add +1 for each additional dice that show "6". Like this: A roll of 5, 4, 2 would present "5". (Highest picked) A roll of 5, 6, 1 would present "6". (Highest picked) A roll of 6, 6, 5 would equal "7" (the five, being lower than the others, is ignored) A roll of 6, 6, 6 would equal "8" (two additional sixes for a combined +2). Which is the part I'm kinda stumbling upon. Something like =IF(AND(Cell1=6;Cell2=6);1+0) will check if two cells both got sixes in them and then add 1 but I don't know what command to use to check how many sixes are rolled when there are more than two dice cells involved (short of brute forcing it with several nested statements but that's not very elegant if I add more dice). Like =IF(AND(C1=6;C2=6;C3=6);2;IF(AND(C1=6;C2=6);1;IF(AND(C2=6;C3=6);1;IF(AND(C1=6;C3=6);1;0)))) will get the job done but maybe there's a better way? Anyone know? Pimpmust fucked around with this message at 19:24 on Jan 13, 2012 |
# ? Jan 13, 2012 18:34 |
|
=MAX(C1:C3)+MAX(COUNTIF(C1:C3,6)-1,0)
|
# ? Jan 13, 2012 19:03 |
|
Pimpmust posted:stuff... code:
Old James fucked around with this message at 19:18 on Jan 13, 2012 |
# ? Jan 13, 2012 19:16 |
|
Still not pulling from the data source like it's supposed to. Worthy of note: a fellow developer can use the spreadsheet perfectly on the SQL server where the spreadsheet was created, using Excel 2003. Could there be something in the file that is getting tossed out when 2007 opens it? We know the data connection is technically working because it functions correctly in Microsoft Query...
|
# ? Jan 16, 2012 13:52 |
|
Have you tried changing the security level to low? You should be able to run a query without having to change that, but perhaps its a function of 2003 -> 2007 security zealotry? Developer Tab > Macro security. If you have any work involving the analysis tool-pak, I know that is different between versions of Excel, maybe that's halting execution. If you look in the VB editor in 2007, missing references (for the workbook, not the VB references) will be highlighted in blue in the project window (Ctrl+R). e: does the remote PC map to the database in the same way that the server pc does? We have a mapped drive L:\ to allow users access to the database stuff, maybe the connection string is to C: rather than the share? gwar3k1 fucked around with this message at 00:13 on Jan 17, 2012 |
# ? Jan 17, 2012 00:09 |
|
gwar3k1 posted:Have you tried changing the security level to low? You should be able to run a query without having to change that, but perhaps its a function of 2003 -> 2007 security zealotry? Developer Tab > Macro security. I'm looking into this now. As far as I can tell the connection string should be fine (especially since it works ok in Microsoft Query), and we've also verified that his version of SQL Native Client is good and he has the appropriate permissions/privileges on the database server. Edit: Old James posted:I think that means this... I can't seem to get this ribbon to display. I've got the developer ribbon, but not this. How do you get it? Powdered Toast Man fucked around with this message at 15:54 on Jan 17, 2012 |
# ? Jan 17, 2012 15:32 |
|
Powdered Toast Man posted:I can't seem to get this ribbon to display. I've got the developer ribbon, but not this. How do you get it? You have to have a table object on the sheet and select a cell within that table for the tab to appear. When I import data in 2007 or later it automatically creates the table object for me. For the purposes of the screen shot I made one by going to the Insert tab and clicking the second button (labelled Table, NOT PivotTable).
|
# ? Jan 17, 2012 18:11 |
|
Really hoping someone can point me in the right direction on this. I have zero experience in coding and am slogging through this project, and I can see the light at the end of the tunnel. The code is ugly and not very efficient, but it works. Just can’t see my way through this last hurdle. I work for a telecom carrier and am creating a proposal tool to auto-generate basic internet access pricing. The product line isn’t complicated so there's really very little in the way of bells and whistles. I have a form that requests all the cust info, which populates on another tab. The user selects checkboxes as to what bandwidth they want to quote, and on what terms, as shown below: I have it set up so that the spreadsheet generates as many rows as are needed (8M, 10M, 20M, etc) and generates columns for the various terms (24 mo, 36 mo, etc.) Each row in the final proposal is being handled by For/Next, i.e. count the number of checkboxes ticked and generate that many quote rows. Then populating the proposal with pricing should just be a series of vlookups, right? The problem I’m having is less about syntax and more about design or approach. How best to handle the varying bandwidths? If a user selects 10M, 20M, and 50M, how does the spreadsheet know to skip the “missing” bandwidth increments (8M, 15M, 30M)? What is the most efficient way to handle something like this? The only thing I've been able to come up with is stacks of nested If/Then statements, but that seems inefficient and I'd like the form to be scalable to incorporate more features and products down the road. Is the key that I should be logically grouping those checkboxes somehow? Currently they're just "standalone" and I'm just going, "if chkbox8M.value = true, then" etc. Any guidance seriously, seriously appreciated.
|
# ? Jan 19, 2012 16:21 |
|
Why don't you just generate a quote for each bandwidth and term? It doesn't seem like a lot of data.
|
# ? Jan 19, 2012 21:05 |
|
Put the checkbox values in to an array then loop the array for evaluation if it makes you feel better. You don't really need to optimise something this small. Alternatively, you could use a function which runs through a nested if but uses Exit Function to break out before it traverses the full statement?
|
# ? Jan 19, 2012 23:28 |
|
Couple of reasons: I intend to add quite a few additional bandwidth increments once the framework is in place. Also the stretch between bandwidth increments is going to be large enough (10M - 1G) that only a small portion will be of interest to a given customer. I also plan to add other services down the road, so I need this chunk to be a template for other products that will demand a little more customization.
|
# ? Jan 19, 2012 23:30 |
|
Okay I'm mildly stumped, trying to import some stuff into excel so I can compare it.. I've got a few windows computers which I exported the windows update lists into text file however, they're delimited by carriage returns. I know how to declare a delimiter but the format of the text file is making excel think that it's one column, when I need to basically make each entry a unique row. It seems like this shhouldn't ultimately be too hard to do in one way or another, but I'm having trouble making excel format the data the way i want, when it imports. I'd prefer to not have to write a macro for this although I guess I could if nobody has a quick way to split these guys into unique rows. I don't really care if the descriptor tags go into the cell with the actual data, either way would ultimately work out the same for my purposes. They look like this: code:
|
# ? Jan 20, 2012 17:54 |
|
coyo7e posted:Okay I'm mildly stumped, trying to import some stuff into excel so I can compare it.. Do you mean make each entry a unique column? Because when I paste your text there into Excel it makes 41 unique rows. If I'm understanding you right, you want all of those carriage returns to effectively be tabs, moving them one cell to the right instead of one cell downwards, is that right? If so, you can just use the "Copy->Paste->Transpose" function, it'll flip everything sideways.
|
# ? Jan 20, 2012 18:28 |
|
Thanks, I knew there was a simple solution I wasn't thinking of!
|
# ? Jan 20, 2012 19:37 |
|
Cancer Wad posted:Couple of reasons: I intend to add quite a few additional bandwidth increments once the framework is in place. Also the stretch between bandwidth increments is going to be large enough (10M - 1G) that only a small portion will be of interest to a given customer. I also plan to add other services down the road, so I need this chunk to be a template for other products that will demand a little more customization. If you are going to be adding new bandwidths then checkboxes are a bit static. Look in to a multi-select listbox (sorry for making things more complicated). This means to add new bandwidths all you need to do is update the source for the listbox and not actually amend the layout of the form. It's then quite straightforward to establish all the selected items in the listbox and iterate through them to do your calculations. EDIT: Off the top of my head something like... code:
G-Dub fucked around with this message at 21:23 on Jan 20, 2012 |
# ? Jan 20, 2012 21:17 |
|
G-Dub posted:If you are going to be adding new bandwidths then checkboxes are a bit static. Look in to a multi-select listbox (sorry for making things more complicated). This means to add new bandwidths all you need to do is update the source for the listbox and not actually amend the layout of the form. It's then quite straightforward to establish all the selected items in the listbox and iterate through them to do your calculations.
|
# ? Jan 21, 2012 09:17 |
|
How do I dereference a cell that I have a text-format reference to? Like, if the function I'm looking for is called xyz, then I could get the concatenation of two random words from a wordlist that's stored in a1-a850 with:code:
|
# ? Jan 27, 2012 02:02 |
|
ejstheman posted:How do I dereference a cell that I have a text-format reference to? Like, if the function I'm looking for is called xyz, then I could get the concatenation of two random words from a wordlist that's stored in a1-a850 with: You're looking for "Indirect". code:
|
# ? Jan 27, 2012 02:09 |
|
DukAmok posted:You're looking for "Indirect". Fantastic! I was totally failing at google there. Much appreciated.
|
# ? Jan 27, 2012 02:16 |
|
ejstheman posted:How do I dereference a cell that I have a text-format reference to? Like, if the function I'm looking for is called xyz, then I could get the concatenation of two random words from a wordlist that's stored in a1-a850 with: I know this was already answered, but I am not a fan of INDIRECT() so you can also do it with OFFSET(). code:
|
# ? Jan 27, 2012 02:38 |
|
Any particular reason? I use indirect just because it was the first google hit when I was trying to solve the same issue.
|
# ? Jan 27, 2012 03:08 |
|
DukAmok posted:Any particular reason? I use indirect just because it was the first google hit when I was trying to solve the same issue. Both INDIRECT() and OFFSET() are volatile functions which means they recalculated with every change to the workbook so extensive use of either will rape your CPU. However, of the two OFFSET() calculates faster. INDEX() is not volatile, so the following might be a better then either of the answers we gave above. code:
Old James fucked around with this message at 04:59 on Jan 27, 2012 |
# ? Jan 27, 2012 04:51 |
|
Is it possible to test if the first 5 characters of a string are numbers, and then remove the rest of the string? EDIT: Also, how do I find the first non-number character in a string? Boz0r fucked around with this message at 13:30 on Jan 27, 2012 |
# ? Jan 27, 2012 13:10 |
|
Boz0r posted:Is it possible to test if the first 5 characters of a string are numbers, and then remove the rest of the string? code:
Boz0r posted:EDIT: Also, how do I find the first non-number character in a string? code:
|
# ? Jan 27, 2012 15:55 |
|
I have an Excel spreadsheet that uses a QueryTable to fetch data from a SQL Server database. It has a Command button that essentially does this:code:
If I go in the VBA editor, there is no code in there that is about a QueryTable or SQL (just some basic formatting stuff). Edit: This is for Excel 2002. Edit 2: Nevermind. Found it. I had to right-click on a cell which was defined in the QueryTable and there were options for Edit Query. Secx fucked around with this message at 22:38 on Jan 31, 2012 |
# ? Jan 31, 2012 22:21 |
|
So, I've got a problem that's looking like it's going to take a lot more time than I expected: I've got monthly metrics reports for a department of ~15 people. There are ~20 different categories that each person reports their activity under. Is ther a convenient way to produce individual, year-to-date reports for each team member? Right now, since we're only in January, it would obviously be pretty simple, but ideally I'd like to be able to pull from up to 12 months worth of either separate sheets or workbooks and have each individual's ytd report show each month as a separate column. Right now I'm frustratingly playing around with PivotTables, but despite being only moderately skilled with Excel, I'm pretty confident there's a better way than this.
|
# ? Feb 6, 2012 20:19 |
|
bairfanx posted:So, I've got a problem that's looking like it's going to take a lot more time than I expected: For a small team like this you could make a master table on one tab with each team member and their stats. In column A have something like "Old James: 2012 01", "Old James: 2012 02", etc. Then create a blank template for the report layout. Copy the template onto a new sheet for each team member with their name in cell A1. Then have the fields where you want values use formulas like "=iferror(vlookup(A1&text(date(2012,1,1),": yyyy mm"),master_table,2,false),"")" to pull the individual stats from the master table. It's not elegant, but gets the job done for a small team. A better option would be to use Access. Old James fucked around with this message at 22:11 on Feb 6, 2012 |
# ? Feb 6, 2012 22:04 |
|
Thanks! I feared there wouldn't be anything too elegant, but I'll give that a shot!Old James posted:It's not elegant, but gets the job done for a small team. A better option would be to use Access. We were using Access before, and then orders from on high said we needed to use SharePoint for everything and right now what we've got going on in SharePoint seemd to only want to output to Excel. edit: Physics major in a business job, I have literally no experience with creating things in Access, only using them. I've been playing with it a bit to see if I can't learn enough to make this both simpler and more aesthetically pleasing. Does anyone know of any good Access introductions? bairfanx fucked around with this message at 20:47 on Feb 7, 2012 |
# ? Feb 7, 2012 20:21 |
|
Still working on this pricing table (original summary of project) and learning a ton about Excel and enjoying wading through this stuff. Couple of (hopefully) straightforward questions: I've opted to attempt doing this via defined names. There's a separate worksheet with a pricing table, and since Excel 2010 seems to automatically define names for the ranges in that table, I guess I'd like to just reference those defined names to obtain pricing. My form takes user selections on bandwidth and term and populates the proposal worksheet thus: Is it possible for the pricing to be done by code that references cell contents for a defined name lookup? For example, for E13 take whatever bandwidth has been populated from C13 and the term from E11 and just leverage the named ranges that Excel already has in place? I know there are plenty of ways to pull that pricing and have tried Application.Vlookup, but these named ranges seem awfully convenient; this works as a formula (= _10M _24Months), but can VBA reference whatever those cells' values are in the current (active) row? If this is a really dumb way to approach, tell me. God, I hope this question makes sense; I'm even shittier at talking about this stuff than I am at doing it. For the record, they didn't hire me to do this or anything, I'm just working on it as a personal project to make my job easier. rivetz fucked around with this message at 16:38 on Feb 10, 2012 |
# ? Feb 10, 2012 16:06 |
|
|
# ? May 11, 2024 11:24 |
I think this is an easy question. Say I have a workbook and on sheet1 I have a list of students. Each row is a separate entry in no particular order. Now say on sheet2 I have a overhead view of the classroom to make a seating chart. Is there a way to have excel link a desk to one of the rows such that by clicking on a desk, that row in sheet1 is displayed in the highlighted region of sheet2? If not, is there a way to automatically add comments to each desk cell that reflect data from sheet1 (so that a quick mouseover of the desk will display the student and his/her information)? Dignity Van Houten fucked around with this message at 23:49 on Feb 10, 2012 |
|
# ? Feb 10, 2012 23:46 |