Prev: How do I set expiry document dates on Excel 2003?
Next: Be Careful while dealing with dynamic type and System.DBNull in C# 4.0(beta)
From: eliza on 29 Apr 2010 01:42 C# 4.0: Provides many new, useful and powerful features. One of those is "dynamic" type. "You can have a number of references with search keyword [Dynamic Type: C# 4.0 ]. I love to use it. I was facing a particular situation while executing sql statement (particulary returning a scalar value) and then returning the result. I thought of using dynamic type: "A function made to execute the scalar sql statment and return the result as type dynamic." By this i would be able to get any type of data without any explicit conversion. So, i built one function to accept randomSql, execute it(Execute NonScalar), return the result. public dynamic FunctionToReturnScalarValue(string aRandomSql) { ///////lines for database connectivity and executing the ///////random sql dynamic result= commandObject.ExecuteScalar(); return result; } http://www.mindfiresolutions.com/Be-Careful-while-dealing-with-dynamic-type-and-SystemDBNull-in-C-40-beta-906.php Reno wrote: Assigning letter for numerical value 20-Jan-10 want to assign a letter or number based on calculated value (much like a grading scale.) If calc value is: ..0 to .25= I ..26 to .50= H .. .. .. final one >5.1 =A can you do as an array beside doing the If > and < formula thx Previous Posts In This Thread: On Wednesday, January 20, 2010 4:29 PM Reno wrote: Assigning letter for numerical value want to assign a letter or number based on calculated value (much like a grading scale.) If calc value is: ..0 to .25= I ..26 to .50= H .. .. .. final one >5.1 =A can you do as an array beside doing the If > and < formula thx On Wednesday, January 20, 2010 5:06 PM Gary''s Student wrote: Use the =VLOOKUP() function--Gary''s Student - gsnu200909"Reno" wrote: Use the =VLOOKUP() function -- Gary''s Student - gsnu200909 "Reno" wrote: On Wednesday, January 20, 2010 5:12 PM Jim Thomlinson wrote: You can use index match as follows... You can use index match as follows... =IF(D2>A21, C21, INDEX(C1:C21, MATCH(D2, A1:A21,1))) Where your data looks like this and your formula is in D2 A B C D 0 0.25 A T 0.26 0.5 B 4.95 0.51 0.75 C 0.76 1 D 1.01 1.25 E 1.26 1.5 F 1.51 1.75 G 1.76 2 H 2.01 2.25 I 2.26 2.5 J 2.51 2.75 K 2.76 3 L 3.01 3.25 M 3.26 3.5 N 3.51 3.75 O 3.76 4 P 4.01 4.25 Q 4.26 4.5 R 4.51 4.75 S 4.76 5 T 5.01 U -- HTH... Jim Thomlinson "Reno" wrote: On Wednesday, January 20, 2010 5:14 PM Jim Thomlinson wrote: Sorry Formula is in D1 and data entry to look up is in D2.--HTH... Sorry Formula is in D1 and data entry to look up is in D2. -- HTH... Jim Thomlinson "Jim Thomlinson" wrote: On Wednesday, January 20, 2010 5:20 PM Lars-?ke Aspelin wrote: If your calculated value is in cell A1, try this formula in the cellwher you If your calculated value is in cell A1, try this formula in the cell wher you want your "grade": =LOOKUP(A1,{0,0.26,0.51,1.01,1.51,2.01,3.01,4.01,5.11},{"I","H","G","F","E","D","C","B","A"}) Change the values to get the correct limits between the different grades. Hope this helps / Lars-?ke On Thursday, January 21, 2010 3:54 AM Rick Rothstein wrote: If your ranges were all of equal length, you could do it with a simpleformula, If your ranges were all of equal length, you could do it with a simple formula, but I am guessing your ranges are not of equal size because you cannot start the way you show (starting at I,H and end up at A) given 0 to 0.25 is I and 0.26 to 0.50 is H. Can you show us all of your actual ranges and their letter assignments? -- Rick (MVP - Excel) Submitted via EggHeadCafe - Software Developer Portal of Choice Free Online Courses Available for Eggheadcafe.com Users http://www.eggheadcafe.com/tutorials/aspnet/5261083e-6e03-4b25-8728-fc3cf6855293/free-online-courses-avail.aspx |