Jump to content

Excel/Sheets Divide and Round Up

Go to solution Solved by b_ondoptical,

So this is what I'm going with.

 

=ROUNDUP(G2/2)+0.99

Divides by 2, rounds up, and adds .99 so I get that wonderful psychological satisfaction of it being less than whatever big number is a penny away.  Thanks everyone!

I'm working on a store inventory list in order to import everything onto WooCommerce all at once.  The store wants to fill both the regular price and sale price fields with all items being around half off.  I've used =(x/2) so it automatically divides by two.  Thing is, this puts out some weird prices like $22.50, $37.50, etc.  I'd like to do make is so that the price rounds out to the nearest 5 (e.g. if half off is 22.50, round up to 24.99.)  Is there a way to program the Round function to do this or am I going about this the wrong way altogether?  Just trying to avoid inputting all the sale prices manually.

Link to comment
Share on other sites

Link to post
Share on other sites

11 minutes ago, b_ondoptical said:

I'm working on a store inventory list in order to import everything onto WooCommerce all at once.  The store wants to fill both the regular price and sale price fields with all items being around half off.  I've used =(x/y) with y column just filled with "2" so it automatically divides by two.  Thing is, this puts out some weird prices like $22.50, $37.50, etc.  I'd like to do make is so that the price rounds out to the nearest 5 (e.g. if half off is 22.50, round up to 24.99.)  Is there a way to program the Round function to do this or am I going about this the wrong way altogether?  Just trying to avoid inputting all the sale prices manually.

What is the highest and lowest priced item?

Internet Connection

My Rig: AMD Ryzen 9 3900X @ 4.3Ghz | Asus Prime X470-Pro | Corsair Vengeance RGB Pro 32 GB (4 x 8GB) DDR-4 3000Mhz OC'd @ 3400Mhz 16-20-20-38 |

EVGA RTX 2070 8GB XC Gaming OC @ 2145Mhz Boosted/ 1925Mhz Memory | WD SN750 500GB M.2 NVME | Gigabye 240GB SSD | 
XSPC EX 360mm | Corsair XC7 RGB CPU WB | EK-Vector RTX 2080 | Alphacool Eisbecher D5 150mm Plexi | XSPC Fittings | XSPC FLX Clear 7/16" ID, 5/8" OD |
Corsair LL120 x6 | Corsair RM750x White 2018 | Corsair Commander Pro | Corsair Obsidian 500D RGB SE | Corsair RGB LED Lighting PRO Expansion |
Corsair Strafe RGB MK.2 | Corsair Ironclaw RGB Wireless 18,000DPI | Acer 32" 4K 60Hz HDR600 Cert. ET322QK CBMIIPZX |

Passmark Score

3dmark Score

PC Parts Picker Link to Build

Network

Netgear LBR20 LTE Router | Verizon Unlimited Prepaid Hotspot Plan

HP 2530-48G-PoEP Switch

Rasberry Pi 4 Running Pihole

Linksys Velop 3 Mesh Wifi AP's

 

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, ddennis002 said:

What is the highest and lowest priced item?

It's a bunch of random; I haven't input everything yet so I don't know.  I think =ROUND(x/2)+.99 is closer to where I want to be and I've settled for using that for now although $100.99 looks a little funny when it pops up.

Link to comment
Share on other sites

Link to post
Share on other sites

15 minutes ago, b_ondoptical said:

I'm working on a store inventory list in order to import everything onto WooCommerce all at once.  The store wants to fill both the regular price and sale price fields with all items being around half off.  I've used =(x/y) with y column just filled with "2" so it automatically divides by two.  Thing is, this puts out some weird prices like $22.50, $37.50, etc.  I'd like to do make is so that the price rounds out to the nearest 5 (e.g. if half off is 22.50, round up to 24.99.)  Is there a way to program the Round function to do this or am I going about this the wrong way altogether?  Just trying to avoid inputting all the sale prices manually.

Think this would work a bit better?

 

=ROUNDUP(X/2,-1)-0.01

Internet Connection

My Rig: AMD Ryzen 9 3900X @ 4.3Ghz | Asus Prime X470-Pro | Corsair Vengeance RGB Pro 32 GB (4 x 8GB) DDR-4 3000Mhz OC'd @ 3400Mhz 16-20-20-38 |

EVGA RTX 2070 8GB XC Gaming OC @ 2145Mhz Boosted/ 1925Mhz Memory | WD SN750 500GB M.2 NVME | Gigabye 240GB SSD | 
XSPC EX 360mm | Corsair XC7 RGB CPU WB | EK-Vector RTX 2080 | Alphacool Eisbecher D5 150mm Plexi | XSPC Fittings | XSPC FLX Clear 7/16" ID, 5/8" OD |
Corsair LL120 x6 | Corsair RM750x White 2018 | Corsair Commander Pro | Corsair Obsidian 500D RGB SE | Corsair RGB LED Lighting PRO Expansion |
Corsair Strafe RGB MK.2 | Corsair Ironclaw RGB Wireless 18,000DPI | Acer 32" 4K 60Hz HDR600 Cert. ET322QK CBMIIPZX |

Passmark Score

3dmark Score

PC Parts Picker Link to Build

Network

Netgear LBR20 LTE Router | Verizon Unlimited Prepaid Hotspot Plan

HP 2530-48G-PoEP Switch

Rasberry Pi 4 Running Pihole

Linksys Velop 3 Mesh Wifi AP's

 

Link to comment
Share on other sites

Link to post
Share on other sites

You could use MOD and QUOTIENT functions to get the fractions and whatnot

 

MOD(CELL,1) will give you the part after the dot ... ex  =MOD(24.5,1) = 0.5

=QUOTIENT(CELL,1) will give you the integer number

 

so you could write something like this:

 

=IF(MOD(CELL,1)=0.5,QUOTIENT(CELL,1)+0.49,CELL)

 

To change number to  [number-1].99  ex 25 becomes 24.99 , you could say something like

 

=IF(MOD(CELL,1)=0,CELL-0.01,CELL)

 

You can place an IF inside another IF , something like

 

=IF(MOD(CELL,1)=0,CELL-0.01,  IF(MOD(CELL,1)=0.5,QUOTIENT(CELL,1)+0.49,CELL)  )

 

You may also want to check out the CEILING function: https://exceljet.net/excel-functions/excel-ceiling-function

 

=CEILING(CELL,0.49)  will convert 24.51.. 24.98 to 24.99

 

Other mathematical functions (LibreCalc documentation but they should be the same in Excel) : https://help.libreoffice.org/Calc/Mathematical_Functions

 

Link to comment
Share on other sites

Link to post
Share on other sites

20 minutes ago, ddennis002 said:

Think this would work a bit better?

 

=ROUNDUP(X/2,-1)-0.01

This rounds to the nearest 9.99, which puts prices a little higher than intended.  Trying not to go that much over the half off price and definitely not under. :D

19 minutes ago, mariushm said:

You could use MOD and QUOTIENT functions to get the fractions and whatnot

 

MOD(CELL,1) will give you the part after the dot ... ex  =MOD(24.5,1) = 0.5

=QUOTIENT(CELL,1) will give you the integer number

 

so you could write something like this:

 

=IF(MOD(CELL,1)=0.5,QUOTIENT(CELL,1)+0.49,CELL)

 

To change number to  [number-1].99  ex 25 becomes 24.99 , you could say something like

 

=IF(MOD(CELL,1)=0,CELL-0.01,CELL)

 

You can place an IF inside another IF , something like

 

=IF(MOD(CELL,1)=0,CELL-0.01,  IF(MOD(CELL,1)=0.5,QUOTIENT(CELL,1)+0.49,CELL)  )

 

You may also want to check out the CEILING function: https://exceljet.net/excel-functions/excel-ceiling-function

 

=CEILING(CELL,0.49)  will convert 24.51.. 24.98 to 24.99

 

Other mathematical functions (LibreCalc documentation but they should be the same in Excel) : https://help.libreoffice.org/Calc/Mathematical_Functions

 

O_O  My last Excel certification was for '07...  Can you use smaller functions? xDDD

Link to comment
Share on other sites

Link to post
Share on other sites

It looks scary but it's actually quite simple..

 

IF  has three parts :   IF (  statement ,  do this if true,  do this if false )

 

So for example  = IF ( CELL = 10 ,  "YES" , "NO" )    means content of cell with this formula becomes  "YES" if the contents of CELL is 10,  "NO" otherwise

 

So now I can use the MOD function to get the remainder of the value divided by 1 ...  remainder of 24.5 divided by 1 will be 0.5  , remainder of 10.1 divided by 1 will be 0.1 and so on.

So now I can say  IF  (remainder of number divided by 1  is 0.5 ,  do the stuff for when number ends with 0.50 , do the stuff for when number ends with anything else )

if ( remainder of cell divided by 1 is 0.5 ,  

     [THEN PART ] put the value of cell minus 0.01 to get .49 at the end , 

     [ELSE PART] just store the original number because i'm not changing anything )

 

Link to comment
Share on other sites

Link to post
Share on other sites

12 minutes ago, mariushm said:

It looks scary but it's actually quite simple..

 

IF  has three parts :   IF (  statement ,  do this if true,  do this if false )

 

So for example  = IF ( CELL = 10 ,  "YES" , "NO" )    means content of cell with this formula becomes  "YES" if the contents of CELL is 10,  "NO" otherwise

 

So now I can use the MOD function to get the remainder of the value divided by 1 ...  remainder of 24.5 divided by 1 will be 0.5  , remainder of 10.1 divided by 1 will be 0.1 and so on.

So now I can say  IF  (remainder of number divided by 1  is 0.5 ,  do the stuff for when number ends with 0.50 , do the stuff for when number ends with anything else )

if ( remainder of cell divided by 1 is 0.5 ,  

     [THEN PART ] put the value of cell minus 0.01 to get .49 at the end , 

     [ELSE PART] just store the original number because i'm not changing anything )

 

That makes more sense.

 

Link to comment
Share on other sites

Link to post
Share on other sites

So this is what I'm going with.

 

=ROUNDUP(G2/2)+0.99

Divides by 2, rounds up, and adds .99 so I get that wonderful psychological satisfaction of it being less than whatever big number is a penny away.  Thanks everyone!

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×