Formatting Number Resulting from VLOOKUP

tgallant

New Member
Joined
Sep 8, 2017
Messages
2
Hey Folks, I couldn't find anything on the forum about this so I'm hoping someone can help.

I have a data extra that I take out of a reporting tool and I use a VLOOKUP on another tab to get a value out of that data. The problem is, the data in the extract comes in showing 6 spaces past the decimal, but depending on the field, I either want it to show no positions past the decimal or a maximum of 2.

My VLOOKUP looks in the data for 2 criteria and brings back a numeric value. The formula I'm using is:

=INDEX('Data.xls'!ALLDATA,MATCH(1,('Data.xls'!AGENTNAME=A6)*('Data.xls'!KPI="HOLD_TIME"),0),3)

As an example, this brings back data of 144.676020

I need that field to display 144.68.

In my mind, it sounded simple. Right click, Format Cells, Number, Decimal places: 2. BUT, that does absolutely nothing when I do it. Even the Sample it shows on that page still shows the 6 numbers after the decimal. Any field not using a VLOOKUP allows formatting without issue so I'm guessing this is in some way due to the VLOOKUP bringing in the data.

Any thoughts on how to modify my VLOOKUP formula to format the data into ###.## or ###? Is this something that can be done through the formula or do I have to go into VBA (which I'm far from strong in)?

Thanks in advance.
 

Excel Facts

Copy formula down without changing references
If you have =SUM(F2:F49) in F50; type Alt+' in F51 to copy =SUM(F2:F49) to F51, leaving the formula in edit mode. Change SUM to COUNT.
Try:

=ROUND(INDEX('Data.xls'!ALLDATA,MATCH(1,('Data.xls'!AGENTNAME=A6)*('Data.xls'!KPI="HOLD_TIME"),0),3),2)

Wow, was it really that easy???? I tried it and it worked perfectly for me. For some reason it also solved another problem I was having with conditional formatting. Thank you a ton! I researched the hell out of this online and everything was telling me VBA. Thank you!
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top