Nested if function question.

Reborom

New Member
Joined
Sep 27, 2023
Messages
1
Office Version
  1. 365
Platform
  1. Windows
I have problems that requires us to calculate Gross Pay using nested if statements. Column A is a named range called Pay_Grade that has values R1, R2, and R3, which correspond to HourlyRate1,HourlyRate2, and HourlyRate3. I need a nested if function to determine which hourly rate will be used for each employee.

Gross pay is calculated by taking the Total Hours worked X the Hourly Rate [HourlyRate1, HourlyRate2, or HourlyRate3] + Over Time hours X Hourly Rate X .5.

The Hourly Rate is determined by comparing each employees Pay Grade (R1, R2 or R3 in column A) with the Pay Grade in the Pay Rate Table. If the pay grade is R1 then the hourly rate is HourlyRate1.

I've tried to do a portion of it by entering: =IF(Pay_Grade="R1",HourlyRate1*Total_Hours,0), but it gives me a SPILL error.

What am I doing wrong?
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.
I have problems that requires us to calculate Gross Pay using nested if statements. Column A is a named range called Pay_Grade that has values R1, R2, and R3, which correspond to HourlyRate1,HourlyRate2, and HourlyRate3. I need a nested if function to determine which hourly rate will be used for each employee.

Gross pay is calculated by taking the Total Hours worked X the Hourly Rate [HourlyRate1, HourlyRate2, or HourlyRate3] + Over Time hours X Hourly Rate X .5.

The Hourly Rate is determined by comparing each employees Pay Grade (R1, R2 or R3 in column A) with the Pay Grade in the Pay Rate Table. If the pay grade is R1 then the hourly rate is HourlyRate1.

I've tried to do a portion of it by entering: =IF(Pay_Grade="R1",HourlyRate1*Total_Hours,0), but it gives me a SPILL error.

What am I doing wrong?
Spill error is because there are values in adjacent cells where that formula is trying to display it's results (usually in the cells below it).

You could try something like this:

Excel Formula:
=LET(n,LOOKUP(Pay_Grade,{R1,R2,R3},{HourlyRate1,HourlyRate2,HourlyRate3}),Total_Hours*n+OT Hours*n*.5)
 
Upvote 0

Forum statistics

Threads
1,223,893
Messages
6,175,242
Members
452,623
Latest member
russelllowellpercy

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