Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Need help with If statement
Hello,
I need help with a nested if statement. How would I build the statement using the following logic: If cell B2 = 2, then add text "00" to the front of what's in cell A2 (="00"&A2). SDF Character Result A2: 63 B2:2 C2:0063 Thanks! Jaret |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Need help with If statement
=IF(B2=2,"00"&A2,"")
I don't know what you want for the false statement so I put a "" value -- Kevin Backmann "mcmilja" wrote: Hello, I need help with a nested if statement. How would I build the statement using the following logic: If cell B2 = 2, then add text "00" to the front of what's in cell A2 (="00"&A2). SDF Character Result A2: 63 B2:2 C2:0063 Thanks! Jaret |
#3
Posted to microsoft.public.excel.misc
|
|||
|
|||
Need help with If statement
Thanks Kevin! How would I throw in several ORs into the statement?
If cell B2 = 1, then add text "000" to A2 (="000"&A2) If cell B2 = 2, then add text "00" to A2 (="00"&A2) OR If cell B2 = 3, then add text "0" to A2 (="0"&A2) OR If cell B2 = 4, then add nothing to A2 (=""&A2) OR SDF Characters Result A2:9 B2:1 C2:0009 A2:63 B2:2 C2:0063 A2:105 B2:3 C2:0105 A2:1005 B2:4 C2:1005 "Kevin B" wrote: =IF(B2=2,"00"&A2,"") I don't know what you want for the false statement so I put a "" value -- Kevin Backmann "mcmilja" wrote: Hello, I need help with a nested if statement. How would I build the statement using the following logic: If cell B2 = 2, then add text "00" to the front of what's in cell A2 (="00"&A2). SDF Character Result A2: 63 B2:2 C2:0063 Thanks! Jaret |
#4
Posted to microsoft.public.excel.misc
|
|||
|
|||
Need help with If statement
The following formula pads your values based upon their respective lengths.
If the length of the value is equal to or greater than 4 you get the value, otherwise the CHOOSE function pads zeroes based upon lenghts 1, 2 and 3: =IF(LEN(A1)=4,A1,CHOOSE(LEN(A1),"000"&A1,"00"&A1, "0"&A1)) -- Kevin Backmann "mcmilja" wrote: Thanks Kevin! How would I throw in several ORs into the statement? If cell B2 = 1, then add text "000" to A2 (="000"&A2) If cell B2 = 2, then add text "00" to A2 (="00"&A2) OR If cell B2 = 3, then add text "0" to A2 (="0"&A2) OR If cell B2 = 4, then add nothing to A2 (=""&A2) OR SDF Characters Result A2:9 B2:1 C2:0009 A2:63 B2:2 C2:0063 A2:105 B2:3 C2:0105 A2:1005 B2:4 C2:1005 "Kevin B" wrote: =IF(B2=2,"00"&A2,"") I don't know what you want for the false statement so I put a "" value -- Kevin Backmann "mcmilja" wrote: Hello, I need help with a nested if statement. How would I build the statement using the following logic: If cell B2 = 2, then add text "00" to the front of what's in cell A2 (="00"&A2). SDF Character Result A2: 63 B2:2 C2:0063 Thanks! Jaret |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Can an If statement answer an If statement? | Excel Discussion (Misc queries) | |||
If statement | Excel Discussion (Misc queries) | |||
appending and IF statement to an existing IF statement | Excel Worksheet Functions | |||
If statement and Isblank statement | Excel Worksheet Functions | |||
Help please, IF statement/SUMIF statement | Excel Worksheet Functions |