Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Selecting "odd" and "even" numbers

Hi!

I have data in the following format in say column A:

A1: 1.0
A2: 1.5
A3: 2.0
A4: 2.5
A5: 3.0

etc. I'm trying to find out if it is possible with an IF statement of similar
to do a calculation if the data is 1.0, 2.0 or 3.0. That is, I don't want to
do a calculation if the data is 1.5, 2.5 etc. I tried the ISEVEN and
ROUND functions without any luck.

The problem shall solve price differences when you don't have even number
of say doughnuts. If you sell 2 doughnuts you have the price for just two
doughnuts. But if someone wants 2.5 doughnuts the price shall be calculated
for 2.5 doughnuts and an additional split charge as well.

2 doughnuts - price = A3*price per doughnuts
2.5 doughnuts - price = A4*price per doughnuts + split charge

Kind Regards

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 461
Default Selecting "odd" and "even" numbers

Try this

=If(Mod(A1,1)=0,A1*Price,A1*Price + Split Charge)

Mod takes the remainder of dividing A1 by 1. So if its 1.5 the answer will
be .5

"Rocketeer" wrote:

Hi!

I have data in the following format in say column A:

A1: 1.0
A2: 1.5
A3: 2.0
A4: 2.5
A5: 3.0

etc. I'm trying to find out if it is possible with an IF statement of similar
to do a calculation if the data is 1.0, 2.0 or 3.0. That is, I don't want to
do a calculation if the data is 1.5, 2.5 etc. I tried the ISEVEN and
ROUND functions without any luck.

The problem shall solve price differences when you don't have even number
of say doughnuts. If you sell 2 doughnuts you have the price for just two
doughnuts. But if someone wants 2.5 doughnuts the price shall be calculated
for 2.5 doughnuts and an additional split charge as well.

2 doughnuts - price = A3*price per doughnuts
2.5 doughnuts - price = A4*price per doughnuts + split charge

Kind Regards

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Selecting "odd" and "even" numbers

Not sure what result you're looking for but this formula will sum only the
whole numbers in the range:

=SUMPRODUCT(--(MOD(A1:A5,1)=0),A1:A5)

And this formula will sum only numbers that have a decimal:

=SUMPRODUCT(--(MOD(A1:A5,1)0),A1:A5)

--
Biff
Microsoft Excel MVP


"Rocketeer" wrote in message
...
Hi!

I have data in the following format in say column A:

A1: 1.0
A2: 1.5
A3: 2.0
A4: 2.5
A5: 3.0

etc. I'm trying to find out if it is possible with an IF statement of
similar
to do a calculation if the data is 1.0, 2.0 or 3.0. That is, I don't want
to
do a calculation if the data is 1.5, 2.5 etc. I tried the ISEVEN and
ROUND functions without any luck.

The problem shall solve price differences when you don't have even number
of say doughnuts. If you sell 2 doughnuts you have the price for just two
doughnuts. But if someone wants 2.5 doughnuts the price shall be
calculated
for 2.5 doughnuts and an additional split charge as well.

2 doughnuts - price = A3*price per doughnuts
2.5 doughnuts - price = A4*price per doughnuts + split charge

Kind Regards



  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 14
Default Selecting "odd" and "even" numbers

Thank you all. This formula made the trick.

Regards

/Peter


"akphidelt" wrote:

Try this

=If(Mod(A1,1)=0,A1*Price,A1*Price + Split Charge)

Mod takes the remainder of dividing A1 by 1. So if its 1.5 the answer will
be .5

"Rocketeer" wrote:

Hi!

I have data in the following format in say column A:

A1: 1.0
A2: 1.5
A3: 2.0
A4: 2.5
A5: 3.0

etc. I'm trying to find out if it is possible with an IF statement of similar
to do a calculation if the data is 1.0, 2.0 or 3.0. That is, I don't want to
do a calculation if the data is 1.5, 2.5 etc. I tried the ISEVEN and
ROUND functions without any luck.

The problem shall solve price differences when you don't have even number
of say doughnuts. If you sell 2 doughnuts you have the price for just two
doughnuts. But if someone wants 2.5 doughnuts the price shall be calculated
for 2.5 doughnuts and an additional split charge as well.

2 doughnuts - price = A3*price per doughnuts
2.5 doughnuts - price = A4*price per doughnuts + split charge

Kind Regards

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Validation ?:Accepting both Numbers AND specific letters("N","n"," Antonio Excel Discussion (Misc queries) 2 April 22nd 08 05:07 PM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
Count occurences of "1"/"0" (or"TRUE"/"FALSE") in a row w. conditions in the next BCB New Users to Excel 7 May 13th 06 10:02 PM
Insert "-" in text "1234567890" to have a output like this"123-456-7890" Alwyn Excel Discussion (Misc queries) 3 October 25th 05 11:36 PM


All times are GMT +1. The time now is 08:09 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"