Solved

Want to Update the Price field and format digits after decimal point in xls.

Posted on 2011-09-05
13
288 Views
Last Modified: 2012-05-12
I have a "our_price" Column field that contains values like : 50.22, 8.78, 68.19, etc.

I want to do 2 things:

1. Raise all prices in the "our_price" field by 18%

2. I want the last 2 digits after the decimal point to be rounded like this :

If :  .01 to .29  =  .29

If :  .30 to .49  =  .49

If :  .50 to .99  =  .95

So if  the price is "29.14", it would be "29.29", . . . "18.78" would be "18.99", etc.

Can I combine these 2 queries at once? Or should I run 2 separate queries?

I'm using Excel Starter 2010,  and a :  Excel 97 - 2003 Workbook ( *.xls)

I'm not good at Exel at all, so the more detailed instructions the better.

Thanks
0
Comment
Question by:MikeMCSD
  • 5
  • 5
  • 3
13 Comments
 
LVL 22

Accepted Solution

by:
Flyster earned 250 total points
ID: 36484492
This will raise your value by 18% and round it as listed above. Change "A1" to the cell containing the price.

=IF((A1*1.18)-INT(A1*1.18)>0.46,INT(A1*1.18)+0.95,IF((A1*1.18)-INT(A1*1.18)>0.29,INT(A1*1.18)+0.49,INT(A1*1.18)+0.29))

Flyster
0
 
LVL 16

Author Comment

by:MikeMCSD
ID: 36484626
thanks Flyster, . .  How do I "run" it?
0
 
LVL 22

Expert Comment

by:Flyster
ID: 36484760
You just paste it into any cell. It will automatically "run" when you enter a value in A1, or whatever cell you want.
0
 
LVL 16

Author Comment

by:MikeMCSD
ID: 36484875
What I have is a sheet that already has 500 rows,
and each column already has the price (like 2.88, 55.44, etc.) in it.

I pasted it in a few columns, and it displays : #NAME?
What do I do in this situation?

0
 
LVL 22

Expert Comment

by:Flyster
ID: 36484917
Say your prices are in A1-A500. In B1 paste the formula above. Now copy that cell, B1, and paste it down to B500. Once pasted, the formula will adjust to the corresponding cells. Just make sure you modify the original formula to reflect the cell with your price, if it isn't already A1.
0
 
LVL 22

Expert Comment

by:Flyster
ID: 36484971
Hopefully the above will work for you. I have to leave for a bit. Will check back later.
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36485126
Another way to do this, using VLOOKUP:

=INT(A2*1.18)+VLOOKUP(MOD(A2*1.18,1),{0,0;0.01,0.29;0.3,0.49;0.5,0.95},2)

Using that big array constant as the lookup table can be confusing, so I usually recommend setting up a lookup table on another worksheet.  So, if you have a worksheet named Lookup, you could enter these in A1:B5...

Start Decimal      Round To
0.00       0.00
0.01       0.29
0.30       0.49
0.50       0.95

My formula above then becomes:

=INT(A2*1.18)+VLOOKUP(MOD(A2*1.18,1),Lookup!$A$2:$B$5,2)

If you are using Excel 2007/2010 and set up that lookup range as a Table, or in any version if you set it up as a named range:

=INT(A2*1.18)+VLOOKUP(MOD(A2*1.18,1),NameOfTableOrRange,2)

For more about VLOOKUP, please see:

http://www.experts-exchange.com/Software/Office_Productivity/Office_Suites/MS_Office/Excel/A_2637-Six-Reasons-Why-Your-VLOOKUP-or-HLOOKUP-Formula-Does-Not-Work.html
0
 
LVL 16

Author Comment

by:MikeMCSD
ID: 36485435
thanks Matt, but I don't understand anything about Excel or formulas, and don't really know how to use that.

>>  In B1 paste the formula above. Now copy that cell, B1, and paste it down to B500.  

There is a field in B1 already. The next empty field is CY1.
I tried selecting that column range and pasting the formula but it give a message saying "the clipboard is larger . . ".


0
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 36485479
OK, let's try again :)

What is the first cell with an original price in it, and what is the first available, unpopulated column?

Based on your comment above, it looks like the first available column is CY.

If the first available price is in A1, then put this in CY1:

=INT(A1*1.18)+VLOOKUP(MOD(A1*1.18,1),{0,0;0.01,0.29;0.3,0.49;0.5,0.95},2)

If the first available price is in A2, then put this in CY2:

=INT(A2*1.18)+VLOOKUP(MOD(A2*1.18,1),{0,0;0.01,0.29;0.3,0.49;0.5,0.95},2)

If the first available price is in W2, then put this in CY2:

=INT(W2*1.18)+VLOOKUP(MOD(W2*1.18,1),{0,0;0.01,0.29;0.3,0.49;0.5,0.95},2)

You get the idea :)

Once you do that, select the cell where you entered the formula, and hit Ctrl+C to copy.  Now select the range you would need to copy that formula to, and hit Enter.
0
 
LVL 16

Author Comment

by:MikeMCSD
ID: 36485528
thanks Matt, . .  that worked but put the new values into the CY column.
I need the original prices that are in E2 - E500 changed. They are still displaying the original value.


=INT(E2*1.18)+VLOOKUP(MOD(E2*1.18,1),{0,0;0.01,0.29;0.3,0.49;0.5,0.95},2)

0
 
LVL 92

Assisted Solution

by:Patrick Matthews
Patrick Matthews earned 250 total points
ID: 36485794
OK, now just select the cells in CY with that formula, and hit Ctrl+C to copy.

Select E2, right click, and select Paste Special from the popup.  Use the Paste Special dialog to select Values, and that will copy over the originals.

Then, just select Column CY and hit delete to clear the formulas.
0
 
LVL 16

Author Comment

by:MikeMCSD
ID: 36485938
perfect
thanks for the help guys
0
 
LVL 22

Expert Comment

by:Flyster
ID: 36486025
I'm glad it worked out for you. Thanks.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Improved? Move/Copy Add-in Replacement - How to avoid the annoying, “A formula or sheet you want to move or copy contains the name XXX, which already exists on the destination worksheet.” David Miller (dlmille)  It was one of those days… I wa…
How to quickly and accurately populate Word documents with Excel data, charts and images (including Automated Bookmark generation) David Miller (dlmille) Synopsis In this article you’ll learn how to use ExcelToWord! to copy data,charts, shapes …
This Micro Tutorial will demonstrate how to use longer labels with horizontal bar charts instead of the vertical column chart.
This Micro Tutorial will demonstrate the scrolling table in Microsoft Excel using the INDEX function.

708 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now