Solved

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

Posted on 2011-09-05
13
290 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
Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

 
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
 
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

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Outlook Free & Paid Tools
Freeze panes is an option within all variants of Excel to enable parts of a sheet to remain stationary when the cursor is in another part of the sheet. This is a very useful feature which is overlooked or under used.
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

786 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