Problem with Formula

J

John

I am trying to re-jig a formula that shows hours worked for a particular
day, to showing any absence detail shown for a particular employee. I have
the fllowing formula which doesn't work and I'm not sure why. A similiar
formula works for me getting basic hours worked etc

=SUMPRODUCT(--(DailyDate=F67)*(StaffNumber=$C$11),(AbsenceDetail))

My range names are correct and all have the same 'length'. F67 is 09/05/05;
StaffNumber = 100 and the value that is within the AbsenceDetail cell for
the 09/05/05 for # 100 is Holiay, except my formula returns 0 (I have it
formatted as General)

Any ideas appreciated


Thanks
 
D

Don Guillett

Try to sum absencedetail

=SUMPRODUCT((DailyDate=F67)*(StaffNumber=$C$11)*AbsenceDetail)
 
A

Aladin Akyurek

In case AbsenceDetail houses text-formatted numbers instead of true numbers:

=SUMPRODUCT(--(DailyDate=F67),--(StaffNumber=$C$11),--AbsenceDetail)
 
B

Bob Phillips

Are you saying that the AbsenceDetail cell contains the text Holiday? If so,
that will sum as 0.
 
J

John

Thats correct Bob, it contains Holiday and returns 0, but I want it to
return 'Holiday'
 
A

Aladin Akyurek

Can you post a few rows from AbsenceDetail?
Aladin / Don

Getting #values returned, I expect the word 'Holidays'

--

[1] The SumProduct function should implicitly coerce the truth values to
their Excel numeric equivalents.
[2] The lookup functions should have an optional argument for the return
value, defaulting to #N/A in its absence.
 
J

John

Aladin, not sure how this will come out, but see below is the Row I am
looking at for the 09/05/05. First value 100 is in Column A, and the
AbsenceDetail is 'Holidays' in Column Q

100 09/05/05 0 0 0 0 0 0 0 0 0 0 0 FHOP Mgr HO Holidays







Aladin Akyurek said:
Can you post a few rows from AbsenceDetail?
Aladin / Don

Getting #values returned, I expect the word 'Holidays'

--

[1] The SumProduct function should implicitly coerce the truth values to
their Excel numeric equivalents.
[2] The lookup functions should have an optional argument for the return
value, defaulting to #N/A in its absence.
 
B

Bob Phillips

You cannot sum text. And what if many cells c ontain Holiday, what do you
want then? Or some don't.

Maybe you want

=SUMPRODUCT(--(DailyDate=F67),--(StaffNumber=$C$11),--(AbsenceDetail="Holida
y"))
 
J

John

Thanks Bob, what I want is whatever value is within the field associated
with the Range Name AbsenceDetail that equates to the DailyDate &
StaffNumber

Can't use hardcoded value of "Holidays' becuase there are quite a number of
different values that can be returned within the AbsenceDetail field
 
A

Aladin Akyurek

It seems you have a lookup question...

Assuming that DailyDate, StaffNumber, and AbsenceDetail are names of the
relevant ranges in different columns:

=INDEX(AbsenceDetail,MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0))

which must be confirmed with control+shift+enter, not just with enter.
Aladin, not sure how this will come out, but see below is the Row I am
looking at for the 09/05/05. First value 100 is in Column A, and the
AbsenceDetail is 'Holidays' in Column Q

100 09/05/05 0 0 0 0 0 0 0 0 0 0 0 FHOP Mgr HO Holidays
[...]
 
J

John

Thanks Aladin, thats exactly what I'm looking for and with the correct
answer also


Aladin Akyurek said:
It seems you have a lookup question...

Assuming that DailyDate, StaffNumber, and AbsenceDetail are names of the
relevant ranges in different columns:

=INDEX(AbsenceDetail,MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0))

which must be confirmed with control+shift+enter, not just with enter.
Aladin, not sure how this will come out, but see below is the Row I am
looking at for the 09/05/05. First value 100 is in Column A, and the
AbsenceDetail is 'Holidays' in Column Q

100 09/05/05 0 0 0 0 0 0 0 0 0 0 0 FHOP Mgr HO Holidays
[...]
 
J

John

Aladin, I'm trying to supress #N/A that result from your formula (i.e. if
the DailyDate I'm looking for does not exist in the Database) and have
entered the following but it says I have too many arguments

{=(if(ISNA(INDEX(AbsenceDetail,MATCH(1,(DailyDate=H70)*(StaffNumber=$C$11),0)),"",(INDEX(AbsenceDetail,MATCH(1,(DailyDate=H70)*(StaffNumber=$C$11),0))}

Any hints?


Aladin Akyurek said:
It seems you have a lookup question...

Assuming that DailyDate, StaffNumber, and AbsenceDetail are names of the
relevant ranges in different columns:

=INDEX(AbsenceDetail,MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0))

which must be confirmed with control+shift+enter, not just with enter.
Aladin, not sure how this will come out, but see below is the Row I am
looking at for the 09/05/05. First value 100 is in Column A, and the
AbsenceDetail is 'Holidays' in Column Q

100 09/05/05 0 0 0 0 0 0 0 0 0 0 0 FHOP Mgr HO Holidays
[...]
 
J

John

Think I have it if it's incorrect someone might let me know

{=IF(ISNA(MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0)),"",(INDEX(AbsenceDetail,MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0))))}

John said:
Aladin, I'm trying to supress #N/A that result from your formula (i.e. if
the DailyDate I'm looking for does not exist in the Database) and have
entered the following but it says I have too many arguments

{=(if(ISNA(INDEX(AbsenceDetail,MATCH(1,(DailyDate=H70)*(StaffNumber=$C$11),0)),"",(INDEX(AbsenceDetail,MATCH(1,(DailyDate=H70)*(StaffNumber=$C$11),0))}

Any hints?


Aladin Akyurek said:
It seems you have a lookup question...

Assuming that DailyDate, StaffNumber, and AbsenceDetail are names of the
relevant ranges in different columns:

=INDEX(AbsenceDetail,MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0))

which must be confirmed with control+shift+enter, not just with enter.
Aladin, not sure how this will come out, but see below is the Row I am
looking at for the 09/05/05. First value 100 is in Column A, and the
AbsenceDetail is 'Holidays' in Column Q

100 09/05/05 0 0 0 0 0 0 0 0 0 0 0 FHOP Mgr HO Holidays
[...]
 
A

Aladin Akyurek

John,

{=IF(ISNA(MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0)),"",(INDEX(AbsenceDetail,MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0))))}

is correct but expensive. How about using a 2-cell approach...

Y2 or any other convenient cell:

{=MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0)}

X2:

=IF(ISNUMBER(Y2),INDEX(AbsenceDetail,Y2),"")

which is confirmed with just enter?

Think I have it if it's incorrect someone might let me know

{=IF(ISNA(MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0)),"",(INDEX(AbsenceDetail,MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0))))}

Aladin, I'm trying to supress #N/A that result from your formula (i.e. if
the DailyDate I'm looking for does not exist in the Database) and have
entered the following but it says I have too many arguments

{=(if(ISNA(INDEX(AbsenceDetail,MATCH(1,(DailyDate=H70)*(StaffNumber=$C$11),0)),"",(INDEX(AbsenceDetail,MATCH(1,(DailyDate=H70)*(StaffNumber=$C$11),0))}

Any hints?


It seems you have a lookup question...

Assuming that DailyDate, StaffNumber, and AbsenceDetail are names of the
relevant ranges in different columns:

=INDEX(AbsenceDetail,MATCH(1,(DailyDate=F67)*(StaffNumber=$C$11),0))

which must be confirmed with control+shift+enter, not just with enter.

John wrote:

Aladin, not sure how this will come out, but see below is the Row I am
looking at for the 09/05/05. First value 100 is in Column A, and the
AbsenceDetail is 'Holidays' in Column Q

100 09/05/05 0 0 0 0 0 0 0 0 0 0 0 FHOP Mgr HO Holidays


[...]
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top