Help with IF Function

  • Thread starter Thread starter Tim
  • Start date Start date
T

Tim

Hello Everybody

I need an If function for the next task in Column H:
Cell H4=F4/G4; H5=F5/G5 and so on.
The Problem is that some of the cells in column G have
values "0" and "1" and I want in this case the value in
the cells of column H just to be equal of the value in
cells of column "F".
For example if G5=0 or if G5=1 the value in H5 must be
the same as the value in F5
But if G5 is not equal to "0" or "1" The value in H5 is
F5/G5.
I tried next function in cell H4 with no success =if(
G4<=1,F4,F4/G4)

Any help is highly greeted.

Thanks in advance
 
Hi Tim!

Try:
=IF(G4=0,F4,F4/G4)

No need to worry about G4 = 1 because F4 and F4/G4 would be the same.

--
Regards
Norman Harker MVP (Excel)
Sydney, Australia
(e-mail address removed)
Excel and Word Function Lists (Classifications, Syntax and Arguments)
available free to good homes.
 
<<<"I tried next function in cell H4 with no success
=if(G4<=1,F4,F4/G4)">>>

I find nothing wrong with your formula.
What exactly do you mean by "no success" ?
 
The problem is more complicated because g4=n4-m4 where
cells "n4" and "m4" are dates which i insert using a
macro and that's why i receive wrong values in H4. If i
insert the dates in "n4" and "m4" using Ctrl+ ;
everithing is OK but if i insert the dates with a macro
using the =Now() function the format of the dates (after
starting the macro) is dd/mmm/yy hh:mm and this causes a
mess if g=1 or g=0 because it calculates those values in
minutes and it gives me a wrong result. It's imposible to
make the macro to insert dates without hh:mm even if i go
to FormatCells/Number/Date and Custom and i set the
format to dd/mmm/yy. After starting the macro format
chnges automaticly to dd/mmm/yy hh:mm like
this:1/26/2004 10:54:49 AM and the only way to make
calculations prperly is to delete manualy the
extension "10:54:49 AM" from "1/26/2004 10:54:49" in
the Formula Bar.
THANK YOU VERY MUCH FOR YOUR INTEREST !!!
 
Hi Tim

maybe you should use the Date function (returns only the current date)
instead of the now function.

HTH
Frank
 
Hi Frank

Which Date Function? I need macro which inserts current
static date in dd/mmm/yy only format.
 
Hi Tim

within your macro you currently should have a line like the following
Activecell.Value = Now / Range("A1").Value = Now

change this to
Activecell.Value = Date / Range("A1").Value = Date

HTH
Frank
 
Why not?

--

Regards,

Peo Sjoblom

Ragdyer said:
That doesn't work with =NOW(), Peo.
--
Regards,

RD

-------------------------------------------------------------------------- -
Please keep all correspondence within the NewsGroup, so all may benefit !
-------------------------------------------------------------------------- -
 
Back
Top