IF and LOOKUP statements

lmmay

Board Regular
Joined
Jun 6, 2014
Messages
87
I have a workbook with a Labor/Equipment sheet. The sheet has dropdown menus for Employee, Title, Status (FT, PT, T) and Equipment. Labor costs are calculated based on work categories (A, B, C – G).
Full time employee regular labor costs are not calculated for categories C – G. Part Time and Temporary employees’ costs are calculated for all categories.
The employee name, title, rate & status (column C) is listed in the payroll record.
This is the formula I am using to calculate the cost for regular time hours.
=IF(AND('PAYROLL RECORD'!$L$6="A",C1>="P"),C3*N3,0)+IF(AND('PAYROLL RECORD'!$L$6="B",$C1>="P"),(C3*N3),0)+IF('PAYROLL RECORD'!$L$6>="C",C3*N3
My problem is the formula can not be copied to each employee block since the employee in the payroll record is in rows 1 through xx and copying changes the C1 (Payroll Record) to the corresponding employee row in this sheet, not C2, C3, etc.
Can the formula be modified to look up the employee for status rather than the column C row?
ABCDEFGHIJKLMNOT1PQ
1Employee/RATE w/COSTRATE1/31/41/51/61/71/81/9REGOT1OT2REG TIME
COST
2EquipmentFRINGECODESunMonTueWedThuFriSat
3NAMEREG0.0
4EQUIP0.0 $ -
5EQUIP0.0 $ -
6EQUIP0.0 $ -
7EQUIP0.0 $ -
8NAMEREG0.0
9EQUIP0.0 $ -
10EQUIP0.0 $ -
11EQUIP0.0 $ -
12EQUIP0.0 $ -

<tbody>
</tbody>
 

Excel Facts

Can Excel fill bagel flavors?
You can teach Excel a new custom list. Type the list in cells, File, Options, Advanced, Edit Custom Lists, Import, OK
Re: Need Help with IF and LOOKUP statements

Assuming you have a list of Employees with their Labor Status (Full-Time & Part-Time) listed side by side, you can use an index-match formula or a vlookup formula depending on which you would be more comfortable with. Assuming your table looks like a mock up I created below, you can use the following formulas & just copy over C1 in your formula. You will have to do some manipulation on the ranges & cell locations. I did my best to explain where everything was using mock ups. Let me know if you have any follow up questions.

Sheet2 Tab:

ABC
4Employee 2FT=INDEX('PAYROLL RECORD'!$B$2:$B$12,MATCH(Sheet2!$B4,'PAYROLL RECORD'!$A$2:$A$12,0))
5
6Employee 4PT=VLOOKUP($B6,'PAYROLL RECORD'!$A$2:$B$12,2,0)

<tbody>
</tbody>


PAYROLL RECORD Tab:
ABC
1NameFT/PTRate
2Employee 1FT14.92
3Employee 2FT12.15
4Employee 3PT11.71
5Employee 4PT14.50
6Employee 5FT15.73
7Employee 6PT13.09
8Employee 7FT15.26
9Employee 8FT16.21
10Employee 9PT12.00
11Employee 10FT15.19
12Employee 11FT17.77

<tbody>
</tbody>

Repost for table legibility and timed out on editing
 
Last edited:
Upvote 0
Re: Need Help with IF and LOOKUP statements

I am a bit confused how that will look in my formula. Could you please show me the VLOOKUP in my formula?
Thank You
 
Upvote 0
Re: Need Help with IF and LOOKUP statements

From this:

=IF(AND('PAYROLL RECORD'!$L$6="A",C1>="P"),C3*N3,0)+IF(AND('PAYROLL RECORD'!$L$6="B",$C1>="P"),(C3*N3),0)+IF('PAYROLL RECORD'!$L$6>="C",C3*N3

to this:

=IF(AND('PAYROLL RECORD'!$L$6="A",VLOOKUP($B6,'PAYROLL RECORD'!$A$2:$B$12,2,0)>="P"),C3*N3,0)+IF(AND('PAYROLL RECORD'!$L$6="B",$VLOOKUP($B6,'PAYROLL RECORD'!$A$2:$B$12,2,0)>="P"),(C3*N3),0)+IF('PAYROLL RECORD'!$L$6>="C",C3*N3
 
Upvote 0
Re: Need Help with IF and LOOKUP statements

Excellent ! Works perfectly ! However, on the Labor-Equip tab, there are 7 blocks to record the employee and equipment. There are occasions when only 1 or 2 of the blocks are used. The formula returns a #N/A in the cost cell.
Can I nest an IF statement in the formula to ignore the empty employee cell?

Thanks
 
Upvote 0
Re: Need Help with IF and LOOKUP statements

Yes, you can do this pretty easily depending on your version of Excel. This formula should do what you want (changes made in red). If this doesn't work, I can write you a different formula that will work on older versions of Excel.

=iferror(IF(AND('PAYROLL RECORD'!$L$6="A",VLOOKUP($B6,'PAYROLL RECORD'!$A$2:$B$12,2,0)>="P"),C3*N3,0)+IF(AND('PAYROLL RECORD'!$L$6="B",$VLOOKUP($B6,'PAYROLL RECORD'!$A$2:$B$12,2,0)>="P"),(C3*N3),0)+IF('PAYROLL RECORD'!$L$6>="C",C3*N3,"")
 
Upvote 0
Solution

Forum statistics

Threads
1,214,827
Messages
6,121,816
Members
449,049
Latest member
cybersurfer5000

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