Question about converting data units

Vermillion

New Member
Joined
Sep 19, 2018
Messages
4
This is probably a dumb question but I have a large set of numbers in an excel spreadsheet that are in the wrong format for what I need (ng/ml instead of uM/L).

Is there a simple way to convert all the numbers in the spreadsheet? I know what formula to use, just no how to easily apply it to all cells.

Thanks!
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
very easy to do this with a macro:

Code:
Sub test()
inarr = Range("A1").CurrentRegion
 For i = 1 To (UBound(inarr, 1))
   For j = 1 To UBound(inarr, 2)
    ' put your equation here
    inarr(i, j) = 32 * (inarr(i, j)) / 30
   Next j
  Next i
Range("A1").CurrentRegion = inarr


  
End Sub
 
Upvote 0
Thanks for the prompt reply! Unfortunately, I'm not sure what to do with that info. I tried to create a macro (using online instructions, but nothing happened. Is the only thing I change in your code the equation or do other parameters need to be altered as well?
 
Upvote 0
You don't need to change anything else in the macro, when you say nothing happened are you sure that you ran the macro?

try adding this msgbox line, this will thorw up a msgbox before running it, you click Ok to run. if you don't get the message box the macro isn't running
Code:
Sub test()
Msgbox("macro will change all the numbers")
inarr = Range("A1").CurrentRegion
 For i = 1 To (UBound(inarr, 1))
   For j = 1 To UBound(inarr, 2)
    ' put your equation here
    inarr(i, j) = 32 * (inarr(i, j)) / 30
   Next j
  Next i
Range("A1").CurrentRegion = inarr




  
End Sub
 
Upvote 0
I got a macro to work, but I must be inputting the equation incorrectly because the new numbers don't make sense. I want each cell to be divided by 1000 and multiplied by 2.45
 
Upvote 0
this should multiply by 2.45 and divide by 1000
Code:
Sub test()
Msgbox("macro will change all the numbers")
inarr = Range("A1").CurrentRegion
 For i = 1 To (UBound(inarr, 1))
   For j = 1 To UBound(inarr, 2)
    ' put your equation here
    inarr(i, j) = 2.45 * (inarr(i, j)) / 1000
   Next j
  Next i
Range("A1").CurrentRegion = inarr
  
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,246
Messages
6,170,996
Members
452,373
Latest member
TimReeks

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