Question Regarding IF Commands

szachary

New Member
Joined
Oct 26, 2011
Messages
15
Hey all,

i am trying to get a simple numberical list of reason codes (1-4) to populate the adjacent cell with the explanation of the unique reason code entered.

For example, if a user in A1 enters the number "1", then the corresponding field A2 will generate the reason code name "Material Damaged". I have the following IF Command written, but I think I have my quotations mixed up? Any help would be greatly appreciated, thanks!!

=IF(H5="1",Sheet2!B5,IF(H5="2",Sheet2!B6,),IF(H5="3",Sheet2!B7"")

In the above formula, the numerous references to sheet 2 are pulling the reason codes I have predefined. I know there is a cleared way to simply specify the reason codes within the formula, I am just unable to get that to work. I can get the following formula to work, but its the third and fourth variables that screw me up:

=IF(H5="1",Sheet2!B5,IF(H5="2",Sheet2!B6,"")
 
Last edited:

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hey all,

i am trying to get a simple numberical list of reason codes (1-4) to populate the adjacent cell with the explanation of the unique reason code entered.

For example, if a user in A1 enters the number "1", then the corresponding field A2 will generate the reason code name "Material Damaged". I have the following IF Command written, but I think I have my quotations mixed up? Any help would be greatly appreciated, thanks!!

=IF(H5="1",Sheet2!B5,IF(H5="2",Sheet2!B6,),IF(H5="3",Sheet2!B7"")
Don't quote numbers...

=IF(H5=1,Sheet2!B5,IF(H5=2,Sheet2!B6,IF(H5=3,Sheet2!B7,"")))
 
Upvote 0
Or, if you cannot have extra tables, you can hardcode a LOOKUP or INDEX/MATCH function to eliminate the need for nested IFs:


=LOOKUP(H5,{1,2,3},{Sheet2!B5,Sheet2!B6,Sheet2!B7})
Can't use cell references inside an array constant:

=LOOKUP(H5,{1,2,3},Sheet2!B5:B7)

Note that any number >3 will return Sheet2!B7.
 
Upvote 0

Forum statistics

Threads
1,222,070
Messages
6,163,739
Members
451,855
Latest member
mcook36155

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top