# Alternate to Nested IF Statement?

#### ryode63

##### New Member
Hello!

I have a spreadsheet that I am working on and need nested if statements. Searching around I find that a lot of excel pro's say that too many if statements is inefficient or can work incorrectly. I'd like an alternative.

In my spreadsheet I have a column (G) of units and need to calculate the dollar amount in (H). I need excel to look at the code in column (D), compare it to a table I have in "Data Sheet" page and calculate. The table has eleven codes starting in (D2) of "data sheet" and the values start in (E2) of data sheet. "data sheet" has a table D1:E12; d has the code and e has the dollar value of that code.

So simply look at the code in G, find that code in another sheet (column D of "data sheet") and multiply the value to the right of the code by the number of units.

Or,

1. Look at D2.
2. Find that code in "Data Sheet"
3. Take the value to the right of the code in data sheet and multiply it by value in G2.

I think I can do this with a nested if function but don't want to begin if there is a better way. Any suggestions or advice would be great.

Ryan

### Excel Facts

Is there a shortcut key for strikethrough?
Ctrl+S is used for Save. Ctrl+5 is used for Strikethrough. Why Ctrl+5? When you use hashmarks to count |||| is 4, strike through to mean 5.

#### gaz_chops

##### Well-known Member
Try with a lookup.

=g2*lookup(D2,lookup range,result range)

#### Simon4s

##### Board Regular

=vlookup(D2,'Data Sheet'!D2:E12,2,false)*G2

This will match D2 with D2 in datasheet and return column E from Data Sheet and multiply it with G2

Replies
3
Views
2K
Replies
0
Views
257
Replies
7
Views
446
Replies
1
Views
486
Replies
4
Views
392

1,195,674
Messages
6,011,105
Members
441,582
Latest member
Topkapi

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