Use of range in an if function

H

helpmeplease

I have a nubmer of days that needs to fall into a certain week number for
pricing calculations. If the number of days is 3:8 then it is 1 week; 9:15
is 2 weeks; and 16:21 is 3 weeks. Right now the function is able to
correctly calculate week 1 and week 2. If I try to insert the week 3
function, I get an error that there are too many arguments. "N5" is the cell
with the number of days. I'm not very advanced with excel (it took me all
morning to get this far), so I would appreciate any help. Thanks!!

=IF(N5<9,IF(N5>2,1,0),IF(N5<16,IF(N5>8,2,0),0))
 
C

CLR

Maybe this..........

=IF(N5>2,LOOKUP(N5,{3,9,16,22},{1,2,3,"Exceeds limit"}),"")

Vaya con Dios,
Chuck, CABGx3
 
D

DaveO

Try this...

=IF(N1>=3, IF(N1>9, IF(N1>15, IF(N1>21, 0, 3), 2), 1), 0)

I must say though that nesting that many IFs is a bit messy. Why not try
using a look-up table of some description?

HTH.
 
P

pdberger

Help --

Try something like:

=IF(N5<3,0,IF(N5<9,1,IF(N5<16,2,IF(N5<22,3,"Too Long!"))))

The other smarter guys around here will have more elegant ways to do this,
but it should work just fine.

HTH
 
R

RagDyeR

Try this:

=LOOKUP(N5,{0,3,9,16;0,1,2,3})

--

HTH,

RD
=====================================================
Please keep all correspondence within the Group, so all may benefit!
=====================================================

I have a nubmer of days that needs to fall into a certain week number for
pricing calculations. If the number of days is 3:8 then it is 1 week; 9:15
is 2 weeks; and 16:21 is 3 weeks. Right now the function is able to
correctly calculate week 1 and week 2. If I try to insert the week 3
function, I get an error that there are too many arguments. "N5" is the
cell
with the number of days. I'm not very advanced with excel (it took me all
morning to get this far), so I would appreciate any help. Thanks!!

=IF(N5<9,IF(N5>2,1,0),IF(N5<16,IF(N5>8,2,0),0))
 
C

CLR

Or...........

=LOOKUP(N5,{0,3,9,16,22},{"",1,2,3,"Exceeds limit"})

Vaya con Dios,
Chuck, CABGx3
 
H

helpmeplease

Thanks a bunch. I knew that my way was a messy way, but as I said I don't
know that much about excel. It works now, though. Thanks.
 
D

Dana DeLouis

Just to be different. Doesn't have error checking though.

=--(N5>=3)+(N5>=9)+(N5>=16)
 

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