Author | Message | Time |
---|---|---|
crankycefx | Friend of mine has a problem in excel, this is copied from another forum: -------- Probably can't explain it so I'll just throw this in and hope you follow; [code] A B C D E A 1.0 1.0 2.0 2.0 1.0 B 0.5 1.0 2.0 1.0 1.0 C 2.0 1.0 1.0 0.5 1.0 D 1.0 2.0 1.0 1.0 1.0 E 1.0 0.5 1.0 1.0 2.0[/code] Got that? Okay, now say on my other sheet I've got the cells where I want the data to be linked to, so it's like Cell Data: A ---------------- Cell Data: B Cell Data: C ---------------- Cell Data: Multiplier Now A, B, C, D, and E are all interchangable. What I want is a function or macro that lets me find that multiplier. The "if" function doesn't work because it needs to go through more than 7 nests, so yeah... I need to go across from the A row, to find the values applicable for B and C, multiply them, and that should give me the multiplier. Problem is, A, B, and C aren't set as A, B, and C. They could change to become any of those data sets. Like I said, the "if" function doesn't work because it needs to go through more than 7. The "vlookup" function won't work because sometimes A could give a value for D, for example, but the data set for D isn't required to find the multiplier in the case. Basically I don't know which column I'll be needing. So yeah, what can I do? I don't know how to write macros or anything so if that's required to be done help would be nice thanks. PS. Helping me with this grants you +50 internet cool points. You will win a PRIZE! | July 7, 2007, 3:44 AM |
Stealth | VBA is pretty easy to use in Excel, and walking across a row of cells is even easier. Just use [code]Range("CELL").Select ' to select the cell whose value you want, ie. Range("A1").Select MsgBox ActiveCell.Value ' will reflect the contents of that cell[/code] Excel's cell naming flexibility lets you reference any cell on any worksheet in your document, and because they're sequentially named using letters and numbers, a For loop can easily traverse them. HTH | July 9, 2007, 1:02 PM |