Converting weights/volume to numerical value

newbieexcel24

New Member
Joined
Mar 14, 2024
Messages
5
Office Version
  1. 365
Platform
  1. Windows
Hi,

I'm trying to convert cells of weights/volumes to a numerical value ie 7kg becomes 7000. I don't understand why the formula below doesn't work for 'ml'. The formula i'm using is:

=IF(RIGHT(D3,1)="L", VALUE(LEFT(D3, LEN(D3)-1))*1000,IF(RIGHT(D3,2)="kg", VALUE(LEFT(D3, LEN(D3)-2))*1000, IF(RIGHT(D3,2)="ml", VALUE(LEFT(D3,LEN(D3)-2)), IF(RIGHT(D3,1)="g", VALUE(LEFT(D3,LEN(D3)-1)),D3))))

I have attached a screenshot.
 

Attachments

  • Screenshot 2024-03-15 141815.png
    Screenshot 2024-03-15 141815.png
    3.9 KB · Views: 4

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
You need to re-order your formula and checking for various values.
You need to check for "ml" BEFORE you check for "L". Otherwise, it will stop at the "L" check and never get to the "ml" check.
 
Upvote 0
Solution
You need to move the ml & g section of the formula before the L & Kg parts
 
Upvote 0
Actually I was wrong, the g & Kg need to stay as they are, just the ml needs to be moved before the L
 
Upvote 0
Actually I was wrong, the g & Kg need to stay as they are, just the ml needs to be moved before the L
Yes, you are correct. Looks like they already have that set in proper order - just the "L" and "ml" need to be changed.
 
Upvote 0
You are welcome.
Glad we were able to help!
 
Upvote 0

Forum statistics

Threads
1,215,106
Messages
6,123,123
Members
449,096
Latest member
provoking

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