# Nested if formula very long

#### nplano1

##### New Member
I have a nested if formula that is extremely long any ideas on how I can shorten it and still have it function properly?
because I have to do this 576 times

=IF(AG443=\$AI\$3,\$AJ\$3,IF(AG443=\$AI\$4,\$AJ\$4,IF(AG443=\$AI\$5,\$AJ\$5,IF(AG443=\$AI\$6,\$AJ\$6,IF(AG443=\$AI\$7,\$AJ\$7,IF(AG443=\$AI\$8,\$AJ\$8,IF(AG443=\$AI\$9,\$AJ\$9,IF(AG443=\$AI\$10,\$AJ\$10,IF(AG443=\$AI\$11,\$AJ\$11,IF(AG443=\$AI\$12,\$AJ\$12,IF(AG443=\$AI\$13,\$AJ\$13,IF(AG443=\$AI\$14,\$AJ\$14,IF(AG443=\$AI\$15,\$AJ\$15,IF(AG443=\$AI\$16,\$AJ\$16,IF(AG443=\$AI\$17,\$AJ\$17,IF(AG443=\$AI\$18,\$AJ\$18,IF(AG443=\$AI\$19,\$AJ\$19,IF(AG443=\$AI\$20,\$AJ\$20,IF(AG443=\$AI\$21,\$AJ\$21,IF(AG443=\$AI\$22,AJ\$22,IF(AG443=0,"")))))))))))))))))))))

### Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
Use a lookup table

=if(ag443=0,"",index(\$aj\$3:\$aj\$22,match(ag443,\$ai\$3:\$ai\$22,0)))

Or

=if(AG443=0,"",vlookup(AG443,\$AI\$3:\$AJ\$22,2,0))

Thank you that worked great, I have just started to learn about Index and match and this is perfect.
Thanks agan

Replies
1
Views
337
Replies
7
Views
157
Replies
9
Views
225
Replies
1
Views
78
Replies
1
Views
151

1,196,188
Messages
6,013,931
Members
441,796
Latest member
kmag

### 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.

### Which adblocker are you using?

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

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