ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   elseif formula (https://www.excelbanter.com/excel-discussion-misc-queries/49155-elseif-formula.html)

macrodummy

elseif formula
 
I am trying to write a formula that would look at D2 and compare it to
determine the value of F2 on the attached sheet. I have tried sumif, elseif
etc... and cannot get this to work. Please help!!!

Need formulas for individual and family

Weekly Hours Emp Cost Individual Emp Cost Family
19 #REF!
21
35
29
39

Compare to this for cost

# of Hrs Individual Family
40 $37.71 $83.62
38 $41.72 $92.51
36 $45.73 $101.40
35 $47.73 $105.84
34 $49.73 $110.28
32 $53.74 $119.17
30 $57.75 $128.06
28 $61.76 $136.00
26 $65.77 $145.83
24 $69.78 $154.72
22 $73.78 $163.61
20 $77.79 $172.49

1st
formula:=IF(D239,L2)(D237<39,L3)(D236<37,L4)(D2 35<36,L5)(D234<35,L6)(D232<34,L7)(D230<32,L8)( D228<30,L9)(D226<28,L10)(D224<26,L11)(D222<24, L12)(D220<22,L13)

2nd formula:
If Weekly Hours = 40 Then
Emp Cost Individual = L2
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L3
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L4
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L5
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L6
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L7
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L8
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L9
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L10
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L11
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L12
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L13

Weekly Hours <= 19
End If
End Function





Duke Carey

Sort your table in ascending order on the hours, then use for the individual
cost

=VLOOKUP(hours,table,2)

change the 2 to a 3 to get the family cost


"macrodummy" wrote:

I am trying to write a formula that would look at D2 and compare it to
determine the value of F2 on the attached sheet. I have tried sumif, elseif
etc... and cannot get this to work. Please help!!!

Need formulas for individual and family

Weekly Hours Emp Cost Individual Emp Cost Family
19 #REF!
21
35
29
39

Compare to this for cost

# of Hrs Individual Family
40 $37.71 $83.62
38 $41.72 $92.51
36 $45.73 $101.40
35 $47.73 $105.84
34 $49.73 $110.28
32 $53.74 $119.17
30 $57.75 $128.06
28 $61.76 $136.00
26 $65.77 $145.83
24 $69.78 $154.72
22 $73.78 $163.61
20 $77.79 $172.49

1st
formula:=IF(D239,L2)(D237<39,L3)(D236<37,L4)(D2 35<36,L5)(D234<35,L6)(D232<34,L7)(D230<32,L8)( D228<30,L9)(D226<28,L10)(D224<26,L11)(D222<24, L12)(D220<22,L13)

2nd formula:
If Weekly Hours = 40 Then
Emp Cost Individual = L2
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L3
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L4
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L5
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L6
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L7
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L8
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L9
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L10
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L11
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L12
ElseIf Weekly Hours = 38 Then
Emp Cost Individual = L13

Weekly Hours <= 19
End If
End Function






All times are GMT +1. The time now is 12:07 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com