Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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
|
|||
|
|||
![]()
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 | |
|
|
![]() |
||||
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 |