Nesting two separate formulas

reneev

Board Regular
Joined
Apr 26, 2017
Messages
53
I've been working on this for an hour. I don't know what I'm missing. In lay-terms what I'm trying to say is (color in text corresponds to color in formula):

If Cell J2 equals "variable" and the date in Cell C2 is equal to or greater than the date in Q1, (Value if true) then look for the Employee ID on this sheet and find it on that sheet then sum all the hours for that person on that sheet, (Value if false) If NOT then just leave a space.

=IF(AND(J2="variable",C2>=$Q$1,SUMIF(A:A,'Pay Period hours'!A:A,'Pay Period hours'!E:E)," ")))

What am I missing or doing wrong?
 

Excel Facts

Add Bullets to Range
Select range. Press Ctrl+1. On Number tab, choose Custom. Type Alt+7 then space then @ sign (using 7 on numeric keypad)
Some parentheses out of place, and your SUMIF had the parameters reversed. If A2 is where the Employee ID is then try:

=IF(AND(J2="variable",C2>=$Q$1),SUMIF('Pay Period hours'!A:A,A2,'Pay Period hours'!E:E)," ")
 
Upvote 0
Solution
Some parentheses out of place, and your SUMIF had the parameters reversed. If A2 is where the Employee ID is then try:

=IF(AND(J2="variable",C2>=$Q$1),SUMIF('Pay Period hours'!A:A,A2,'Pay Period hours'!E:E)," ")
ok, that got rid of the error, but it should have resulted in the calculation and it's resulting in a space/
 
Upvote 0
If it's a space, then the AND function must not be true. So either J2 is not equal to "variable", or C2 is not greater than Q1. J2 should be easy to check, but make sure there's no hidden spaces. And for the date comparison, make sure that the dates are both stored as dates (a number), and not a date stored as text.
 
Upvote 0
FOUND IT!! There was an extra comma after $Q$1

=IF(AND(J1122="variable",C1122>=$Q$1,),SUMIF('Pay Period hours'!A:A,A1122,'Pay Period hours'!E:E)," ")

Thank you!
 
Upvote 0

Forum statistics

Threads
1,214,839
Messages
6,121,892
Members
449,058
Latest member
Guy Boot

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