View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default If Then formula for excel

This basically uses Nate's approach, but used Choose rather than vlookup and
adds a few more checks.

=IF(OR(WEEKDAY(A3)=1,WEEKDAY(A3)=7,SUM(COUNTIF(A1, {"A","B","C"}))=0),"",A3+(
A1="A")*CHOOSE(WEEKDAY(A3)-1,4,6,5,4,4)+(A1="B")*CHOOSE(WEEKDAY(A3)-1,7,6,5,
5,5)+(A1="C")*CHOOSE(WEEKDAY(A3)-1,7,6,6,6,6))

--
Regards,
Tom Ogilvy



"Nate Oliver" wrote in message
...
Hello,

Assuming A1 houses A,B,C or otherwise, try the following:


=IF(WEEKDAY(A3)=1,"",IF(A1="A",VLOOKUP(WEEKDAY(A3) ,{2,4;3,6;4,5;5,4;6,4},2,0
)+A3,IF(A1="B",VLOOKUP(WEEKDAY(A3),{2,7;3,6;4,5;5, 5;6,5},2,0)+A3,IF(A1="C",V
LOOKUP(WEEKDAY(A3),{2,7;3,6;4,6;5,6;6,6},2,0)+A3," "))))

Best Regards,
Nate Oliver