Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
Hello,
I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
Ho Stockwell,
If you check Excel's Help for the IF worksheet function, you will obtain the required syntax and see various examples of the function's use. --- Regards, Norman "Stockwell43" wrote in message ... Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
On May 9, 1:24 pm, Stockwell43
wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
Hi Andrew,
What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
You a combination of If and Or. Formula in G15 would be:
=IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) HTH -Jeff- Stockwell43 wrote: Hi Andrew, What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
Hi JW,
This works great! how can I do this with several sets together. Exmaple: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) and then another set of number like F15=444,F15=445,F15=446,F15=447),0.1666,0.0014) and so on about five more times. I know this seems ridiculous but it's what the boss what and I haven't the faintest idea about how to do it. If there is another way to sum all this up easier, I'm all ears. If not, they can just enter in the information manually. I already spent the entire day on it and with your formula am very close but I have several sets of codes that are based on the type of collateral. Sorry to be a bother but do appreciate your help! "JW" wrote: You a combination of If and Or. Formula in G15 would be: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) HTH -Jeff- Stockwell43 wrote: Hi Andrew, What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
You need to 'nest' If statements together. You can look at this like
an If..ElseIf..ElseIf..Else type of thing. Here's an example using what you posted below. =IF(OR(F15=230,F15=231,F15=331,F15=336), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014)) Keep in mind, there is a limit of 7 nested If statements allowed. If you can provide all of your possible scenarios, I'll throw the forumla together for you real quick. HTH -Jeff- Stockwell43 wrote: Hi JW, This works great! how can I do this with several sets together. Exmaple: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) and then another set of number like F15=444,F15=445,F15=446,F15=447),0.1666,0.0014) and so on about five more times. I know this seems ridiculous but it's what the boss what and I haven't the faintest idea about how to do it. If there is another way to sum all this up easier, I'm all ears. If not, they can just enter in the information manually. I already spent the entire day on it and with your formula am very close but I have several sets of codes that are based on the type of collateral. Sorry to be a bother but do appreciate your help! "JW" wrote: You a combination of If and Or. Formula in G15 would be: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) HTH -Jeff- Stockwell43 wrote: Hi Andrew, What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
I tried it but it didn't work. Once I enter the code (the one beloew to test)
it automatically put in 0.0014 in cell G15. The first piece of code you send me worked great however. Did maybe I do something wrong? I copied and pasted exactly what was written. "JW" wrote: You need to 'nest' If statements together. You can look at this like an If..ElseIf..ElseIf..Else type of thing. Here's an example using what you posted below. =IF(OR(F15=230,F15=231,F15=331,F15=336), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014)) Keep in mind, there is a limit of 7 nested If statements allowed. If you can provide all of your possible scenarios, I'll throw the forumla together for you real quick. HTH -Jeff- Stockwell43 wrote: Hi JW, This works great! how can I do this with several sets together. Exmaple: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) and then another set of number like F15=444,F15=445,F15=446,F15=447),0.1666,0.0014) and so on about five more times. I know this seems ridiculous but it's what the boss what and I haven't the faintest idea about how to do it. If there is another way to sum all this up easier, I'm all ears. If not, they can just enter in the information manually. I already spent the entire day on it and with your formula am very close but I have several sets of codes that are based on the type of collateral. Sorry to be a bother but do appreciate your help! "JW" wrote: You a combination of If and Or. Formula in G15 would be: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) HTH -Jeff- Stockwell43 wrote: Hi Andrew, What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
The formula I sent most recently works fine onmy machine. The way the
formula is setup is that, if nothing is entered at all, it will place . 0014 in the cell. If you don't want to do it that way, we can add another If statement to the beginning to see if F15 is blank. =IF(F15="","",IF(OR(F15=230,F15=231,F15=331,F15=33 6), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014))) Stockwell43 wrote: I tried it but it didn't work. Once I enter the code (the one beloew to test) it automatically put in 0.0014 in cell G15. The first piece of code you send me worked great however. Did maybe I do something wrong? I copied and pasted exactly what was written. "JW" wrote: You need to 'nest' If statements together. You can look at this like an If..ElseIf..ElseIf..Else type of thing. Here's an example using what you posted below. =IF(OR(F15=230,F15=231,F15=331,F15=336), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014)) Keep in mind, there is a limit of 7 nested If statements allowed. If you can provide all of your possible scenarios, I'll throw the forumla together for you real quick. HTH -Jeff- Stockwell43 wrote: Hi JW, This works great! how can I do this with several sets together. Exmaple: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) and then another set of number like F15=444,F15=445,F15=446,F15=447),0.1666,0.0014) and so on about five more times. I know this seems ridiculous but it's what the boss what and I haven't the faintest idea about how to do it. If there is another way to sum all this up easier, I'm all ears. If not, they can just enter in the information manually. I already spent the entire day on it and with your formula am very close but I have several sets of codes that are based on the type of collateral. Sorry to be a bother but do appreciate your help! "JW" wrote: You a combination of If and Or. Formula in G15 would be: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) HTH -Jeff- Stockwell43 wrote: Hi Andrew, What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#10
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
You know what JW, it does work fine. I had it in G14 to read F14 instead of
F15. I am so sorry for that but I have been looking at this all day and my eyes are not focusing properly on what I am doing. So if I keep adding addtional sets, all I have to do is add another ) at the end of the formula for each set I add? "JW" wrote: The formula I sent most recently works fine onmy machine. The way the formula is setup is that, if nothing is entered at all, it will place . 0014 in the cell. If you don't want to do it that way, we can add another If statement to the beginning to see if F15 is blank. =IF(F15="","",IF(OR(F15=230,F15=231,F15=331,F15=33 6), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014))) Stockwell43 wrote: I tried it but it didn't work. Once I enter the code (the one beloew to test) it automatically put in 0.0014 in cell G15. The first piece of code you send me worked great however. Did maybe I do something wrong? I copied and pasted exactly what was written. "JW" wrote: You need to 'nest' If statements together. You can look at this like an If..ElseIf..ElseIf..Else type of thing. Here's an example using what you posted below. =IF(OR(F15=230,F15=231,F15=331,F15=336), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014)) Keep in mind, there is a limit of 7 nested If statements allowed. If you can provide all of your possible scenarios, I'll throw the forumla together for you real quick. HTH -Jeff- Stockwell43 wrote: Hi JW, This works great! how can I do this with several sets together. Exmaple: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) and then another set of number like F15=444,F15=445,F15=446,F15=447),0.1666,0.0014) and so on about five more times. I know this seems ridiculous but it's what the boss what and I haven't the faintest idea about how to do it. If there is another way to sum all this up easier, I'm all ears. If not, they can just enter in the information manually. I already spent the entire day on it and with your formula am very close but I have several sets of codes that are based on the type of collateral. Sorry to be a bother but do appreciate your help! "JW" wrote: You a combination of If and Or. Formula in G15 would be: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) HTH -Jeff- Stockwell43 wrote: Hi Andrew, What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#11
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
Sorta. It's a little more to it than that. YOu have to place each If
statement in the appropriate place or it will produce incorrect results or an error. Do a google search on Nested If Statements. You will find plenty of resources. Stockwell43 wrote: You know what JW, it does work fine. I had it in G14 to read F14 instead of F15. I am so sorry for that but I have been looking at this all day and my eyes are not focusing properly on what I am doing. So if I keep adding addtional sets, all I have to do is add another ) at the end of the formula for each set I add? "JW" wrote: The formula I sent most recently works fine onmy machine. The way the formula is setup is that, if nothing is entered at all, it will place . 0014 in the cell. If you don't want to do it that way, we can add another If statement to the beginning to see if F15 is blank. =IF(F15="","",IF(OR(F15=230,F15=231,F15=331,F15=33 6), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014))) Stockwell43 wrote: I tried it but it didn't work. Once I enter the code (the one beloew to test) it automatically put in 0.0014 in cell G15. The first piece of code you send me worked great however. Did maybe I do something wrong? I copied and pasted exactly what was written. "JW" wrote: You need to 'nest' If statements together. You can look at this like an If..ElseIf..ElseIf..Else type of thing. Here's an example using what you posted below. =IF(OR(F15=230,F15=231,F15=331,F15=336), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014)) Keep in mind, there is a limit of 7 nested If statements allowed. If you can provide all of your possible scenarios, I'll throw the forumla together for you real quick. HTH -Jeff- Stockwell43 wrote: Hi JW, This works great! how can I do this with several sets together. Exmaple: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) and then another set of number like F15=444,F15=445,F15=446,F15=447),0.1666,0.0014) and so on about five more times. I know this seems ridiculous but it's what the boss what and I haven't the faintest idea about how to do it. If there is another way to sum all this up easier, I'm all ears. If not, they can just enter in the information manually. I already spent the entire day on it and with your formula am very close but I have several sets of codes that are based on the type of collateral. Sorry to be a bother but do appreciate your help! "JW" wrote: You a combination of If and Or. Formula in G15 would be: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) HTH -Jeff- Stockwell43 wrote: Hi Andrew, What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#12
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
Ok, I'll check it and see if I can grasp it. I do appreciate you staying with
me on this and explaining the formula in detail. You were a huge help and I thank you for that. I may need to post back for more once I get the rest of the codes from my manager if I cannot figure it out on my own. I did save the formula in case I run into this again. In the menatime have a wonderful day and again, thank you! "JW" wrote: Sorta. It's a little more to it than that. YOu have to place each If statement in the appropriate place or it will produce incorrect results or an error. Do a google search on Nested If Statements. You will find plenty of resources. Stockwell43 wrote: You know what JW, it does work fine. I had it in G14 to read F14 instead of F15. I am so sorry for that but I have been looking at this all day and my eyes are not focusing properly on what I am doing. So if I keep adding addtional sets, all I have to do is add another ) at the end of the formula for each set I add? "JW" wrote: The formula I sent most recently works fine onmy machine. The way the formula is setup is that, if nothing is entered at all, it will place . 0014 in the cell. If you don't want to do it that way, we can add another If statement to the beginning to see if F15 is blank. =IF(F15="","",IF(OR(F15=230,F15=231,F15=331,F15=33 6), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014))) Stockwell43 wrote: I tried it but it didn't work. Once I enter the code (the one beloew to test) it automatically put in 0.0014 in cell G15. The first piece of code you send me worked great however. Did maybe I do something wrong? I copied and pasted exactly what was written. "JW" wrote: You need to 'nest' If statements together. You can look at this like an If..ElseIf..ElseIf..Else type of thing. Here's an example using what you posted below. =IF(OR(F15=230,F15=231,F15=331,F15=336), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014)) Keep in mind, there is a limit of 7 nested If statements allowed. If you can provide all of your possible scenarios, I'll throw the forumla together for you real quick. HTH -Jeff- Stockwell43 wrote: Hi JW, This works great! how can I do this with several sets together. Exmaple: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) and then another set of number like F15=444,F15=445,F15=446,F15=447),0.1666,0.0014) and so on about five more times. I know this seems ridiculous but it's what the boss what and I haven't the faintest idea about how to do it. If there is another way to sum all this up easier, I'm all ears. If not, they can just enter in the information manually. I already spent the entire day on it and with your formula am very close but I have several sets of codes that are based on the type of collateral. Sorry to be a bother but do appreciate your help! "JW" wrote: You a combination of If and Or. Formula in G15 would be: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) HTH -Jeff- Stockwell43 wrote: Hi Andrew, What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
#13
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Code Please help!!
No problem. I'll help in any way I can.
Stockwell43 wrote: Ok, I'll check it and see if I can grasp it. I do appreciate you staying with me on this and explaining the formula in detail. You were a huge help and I thank you for that. I may need to post back for more once I get the rest of the codes from my manager if I cannot figure it out on my own. I did save the formula in case I run into this again. In the menatime have a wonderful day and again, thank you! "JW" wrote: Sorta. It's a little more to it than that. YOu have to place each If statement in the appropriate place or it will produce incorrect results or an error. Do a google search on Nested If Statements. You will find plenty of resources. Stockwell43 wrote: You know what JW, it does work fine. I had it in G14 to read F14 instead of F15. I am so sorry for that but I have been looking at this all day and my eyes are not focusing properly on what I am doing. So if I keep adding addtional sets, all I have to do is add another ) at the end of the formula for each set I add? "JW" wrote: The formula I sent most recently works fine onmy machine. The way the formula is setup is that, if nothing is entered at all, it will place . 0014 in the cell. If you don't want to do it that way, we can add another If statement to the beginning to see if F15 is blank. =IF(F15="","",IF(OR(F15=230,F15=231,F15=331,F15=33 6), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014))) Stockwell43 wrote: I tried it but it didn't work. Once I enter the code (the one beloew to test) it automatically put in 0.0014 in cell G15. The first piece of code you send me worked great however. Did maybe I do something wrong? I copied and pasted exactly what was written. "JW" wrote: You need to 'nest' If statements together. You can look at this like an If..ElseIf..ElseIf..Else type of thing. Here's an example using what you posted below. =IF(OR(F15=230,F15=231,F15=331,F15=336), 0.1,IF(OR(F15=444,F15=445,F15=446,F15=447),0.1666, 0.0014)) Keep in mind, there is a limit of 7 nested If statements allowed. If you can provide all of your possible scenarios, I'll throw the forumla together for you real quick. HTH -Jeff- Stockwell43 wrote: Hi JW, This works great! how can I do this with several sets together. Exmaple: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) and then another set of number like F15=444,F15=445,F15=446,F15=447),0.1666,0.0014) and so on about five more times. I know this seems ridiculous but it's what the boss what and I haven't the faintest idea about how to do it. If there is another way to sum all this up easier, I'm all ears. If not, they can just enter in the information manually. I already spent the entire day on it and with your formula am very close but I have several sets of codes that are based on the type of collateral. Sorry to be a bother but do appreciate your help! "JW" wrote: You a combination of If and Or. Formula in G15 would be: =IF(OR(F15=230,F15=231,F15=331,F15=336),0.1000,0.0 014) HTH -Jeff- Stockwell43 wrote: Hi Andrew, What you are saying does make sense to me. What I need to do is to say something like: If F15 = 230,231,331,336 Then G15 = 0.1000 else 0.0014 In the logical test, I do one value but not several. How do I do this so if any of the above number are input into F15 G15 will show 0.1000 and if the number in F15 is not one of the above G15 will show 0.0014? Any help you can give me would most appreciated. Thank you!! "Andrew" wrote: On May 9, 1:24 pm, Stockwell43 wrote: Hello, I am not very familar with Excel programming but here it goes. My manager gave me a spreadsheet that need an If statement in a cell. It is actually in each cell in the whole column. When I figure out what the statement should be, where do I put it? How do I get to the screen where I put the code in? Surely it can't be a macro can it? Any help would be most appreciated. Thanks!! Hi This isn't really VBA. There is a VBA IF statement, but it looks like you're needing a simple Worksheet Function (in other words one which goes into a cell, rather than one is written as part of a VBA routine). That said, you need to select the cell in which you want to see the answer appear, and simply type the function, with it's supporting information (the "arguments"), preceded by an = sign, into that cell. As an example, if A1 and B1 contained sales figures, and you wanted to mark them as either HIGH or LOW in C1, depending on whether the total sale was above 100, you would type the following into C1 (not forgetting to press Enter at the end): =IF(A1+B1100,"HIGH","LOW") As you may be able to see from this, there are 3 parts to the IF function, separated with commas. The first part is the TEST - what you're looking to evaluate. In this case, we simply said A1+B1100, but we could also have written something like SUM(A1:B1)100 and the result would be the same. The second part is what to do if the test is TRUE - in other words A1+B1 IS greater than 100. In this case, we simply said "put the word 'HIGH' in the current cell (C1)" But we could just as easily have said something like (A1+B1)*1.1 if we'd wanted to show the value of adding 10% to the total of A1+B1, or indeed any other such calculation. Just remember that if you want to put a piece of text rather than a calculation, that text must go in quotation marks. The final part of the function is what to do if the test is FALSE. It follows all the same rules and patterns as the TRUE part, as described above. The three parts - again, called the arguments, or the parameters - are surrounded by parentheses. You mention having to put the formula in every cell in a column. The best way to do this is to get the formula to work in the first cell. Once you're happy that it's giving you the answer you need, select that cell with the answer (C1 in our example above) and then hover with the mouse over the black dot in the bottom-right corner of the cell. This is known as the AutoFill Handle. The mouse pointer will change to a black cross. When you have this appearing, click and drag down in the column for as far as you want the formula to be copied. This should do the trick for you! Andrew |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
split post code (zip code) out of cell that includes full address | Excel Discussion (Misc queries) | |||
Slow code when used as VBA code instead of macro (copying visible columns) | Excel Programming | |||
Shorten code to apply to all sheets except a few, instead of individually naming them, and later adding to code. | Excel Programming | |||
Protect Sheet with code, but then code will not Paste error. How do i get around this. Please read for explainations.... | Excel Programming | |||
Excel code convert to Access code - Concat & eliminate duplicates | Excel Programming |