Formula help

Mr_Mod

New Member
Joined
May 29, 2016
Messages
6
I have a workbook that has many sheets within it each worksheet has a cell H2 which is a different value on a number of sheets e.g. 26.245

There is an index sheet which gets populated with values from each of the sheets, everything works well except for filling data in one particular cell
The formule I am using is

Me.Cells(1, 8) = (Mid(wSheet.Range("H2").Value, 1, 2) + (wSheet.Range("H2").Value, 3, 3)*32)))

So the formula should be A+(B*32) where A = 26 , and B = 245

One of the other cells on the index sheet gets populated using Me.Cells(1, 7) = Mid(wSheet.Range("G6").Value, 1, 6), so i know that part works.

What am i doing wrong in the formula?
 

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Assuming those values are numbers (which they must be as you haven't included a full stop)
t's your plus sign. Plus means add so you're probably ending up with 26+245*32 = 7866. If so, try

Code:
Me.Cells(1, 8) = (Mid(wSheet.Range("H2").Value, 1, 2) + (wSheet.Range("H2").Value, 3, 3)*32)))/1000
 
Upvote 0
Thanks Special K99

I seem to be getting "Syntax error" when using that piece of code, one thing I should have mentioned is that all cells are set as general and not as a number
 
Upvote 0
I'm afraid that's a typo on your part, I just copied the formula from your post
In particular this

(wSheet.Range("H2").Value, 3, 3)

You've left the function name out, so what does "3, 3" relate to ?
I'm guessing it should be Mid
So you probably want

Me.Range.Cells(1, 8) = (Mid(wSheet.Range("H2").Value, 1, 2) + Mid(wSheet.Range("H2").Value, 3, 3) / 1000) * 32
 
Upvote 0
On second thoughts maybe the formula should be

Me.Range.Cells(1, 8) = Mid(wSheet.Range("H2").Value, 1, 2) + Mid(wSheet.Range("H2").Value, 3, 3) / 1000 * 32
 
Upvote 0

Forum statistics

Threads
1,215,071
Messages
6,122,963
Members
449,094
Latest member
Anshu121

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