SQRT function

VBABEGINER

Well-known Member
Joined
Jun 15, 2011
Messages
1,284
Office Version
  1. 365
Platform
  1. Windows
Hey Guys,

Can any pls tell me how to use SQRT function.

I dont know the syntax.

Cells(fn, 7) = (Cells(fn, 5) ^ 2) + (Cells(fn, 6) ^ 2)

i wanted,

Cells(fn, 7) = SQRT(Cells(fn, 5) ^ 2) + (Cells(fn, 6) ^ 2)

But this not right. 1 hour i used to r&d.:banghead:

Pls any onnnnne
 

Excel Facts

Does the VLOOKUP table have to be sorted?
No! when you are using an exact match, the VLOOKUP table can be in any order. Best-selling items at the top is actually the best.
Try

Code:
Cells(fn, 7).Value = Sqr(Cells(fn, 5).Value ^ 2 + Cells(fn, 6).Value ^ 2)
 
Upvote 0
Try

Code:
Cells(fn, 7).Value = Sqr(Cells(fn, 5).Value ^ 2 + Cells(fn, 6).Value ^ 2)

Thank You very Much Sir.

It is kindly request Sir,
Please provide me the knowledge through this types query's.
So I also can be a part MrExcel.

It's great Solution.
 
Upvote 0
Try like this

Rich (BB code):
Cells(fn, 7).Value = WorksheetFunction.RoundUp(Sqr(Cells(fn, 5).Value * 2) + (Cells(fn, 6).Value * 2), 0)

Change the 0 to the number of decimal places.
 
Upvote 0
Vog Sir,
:beerchug:

I want to show one more code. The commented part is the interior part.
I left this part, coz it has been 2-3 weeks i was trying.
But i dnt know y error contonuolsy giving.

I need your solution. Pls have look. I think some small fraction could not on right place.

Public Function FindnCalculate()
Dim fn As Long
Dim cnt As Long
Dim mykW As Double
Dim mykVar As Double
Dim mykVA As Double
Dim p As Integer

'With Application.Range(Cells(lRowCounter - 1, 1), Cells(lRowCounter, 1))
' .Merge
' .VerticalAlignment = xlCenter
' .HorizontalAlignment = xlCenter
'End With

cnt = Range("A" & Rows.Count).End(xlDown).Row

For fn = 1 To cnt
If (Right(Cells(fn, 1), 8)) = "Totals: " And Cells(fn, 10) <> "" Then
p = fn

fn = fn + 15

Cells(fn, 2) = "LOAD SUMMARY:"
'With Application.Range(Cells(fn, 2), Cells(fn, 3))
'.Merge
'.Font.Bold = True
'.HorizontalAlignment = xlCenter
'End With

fn = fn + 1

Cells(fn, 2) = "(100 % continuous load (E) + 30 % Intermittent load (F) + 100% standby (G)) for MCC Sizing"

'With Application.Range(Cells(fn, 2), Cells(fn, 3))
'.Merge
'.Font.Bold = True
'.HorizontalAlignment = xlCenter
'End With

fn = fn - 1

Cells(fn, 5) = "kW"
'Cells(fn, "E").Font.Bold = True
'Cells(fn, "E").HorizontalAlignment = xlCenter

fn = fn + 1
Cells(fn, 5) = Cells(p, 10) + Cells(p, 12) * 0.3 + Cells(p, 14)

fn = fn - 1

Cells(fn, 6) = "kVar"
'Cells(fn, "F").Font.Bold = True
'Cells(fn, "F").HorizontalAlignment = xlCenter

fn = fn + 1
Cells(fn, 6) = Cells(p, 11) + Cells(p, 13) * 0.3 + Cells(p, 15)

fn = fn - 1

Cells(fn, 7) = "kVA"
'Cells(fn, "G").Font.Bold = True
'Cells(fn, "G").HorizontalAlignment = xlCenter

fn = fn + 1
'Cells(fn, 8) = Cells(fn, 5) * Cells(fn, 5)
'Cells(fn, 9) = Cells(fn, 6) * Cells(fn, 6)
'Cells(fn, 10) = Cells(fn, 8) + Cells(fn, 9)
'Cells(fn, 11) = Sqr(Cells(fn, 10))

'Cells(fn, 7).Value = RoundUp(Sqr(Cells(fn, 5).Value * 2) + (Cells(fn, 6).Value * 2))
Cells(fn, 7).Value = WorksheetFunction.RoundUp(Sqr(Cells(fn, 5).Value * 2) + (Cells(fn, 6).Value * 2), 2)

fn = fn + 2

Cells(fn, 2) = "Total Operating load current in MCC = "
'With Application.Range(Cells(fn, 2), Cells(fn, 3))
'.Merge
'.Font.Bold = True
'.HorizontalAlignment = xlCenter
'End With

'=+G58/(1.732*0.38)

Cells(fn, 5) = Cells(fn - 2, 7) / (1.732 * 0.38)
'Range(Cells(fn, 5), Cells(fn, 6), Cells(fn, 7)).Merge = True
'With Application.Range(Cells(fn, 5), Cells(fn, 6), Cells(fn, 7))
'.Merge
'.Font.Bold = True
'.HorizontalAlignment = xlCenter
'End With
End If
Next
End Function

Bcoz this interior i commented, all part i need to do mannualy.
 
Upvote 0
The syntax looks correct.

You don't need Application.Range, just Range

What is the value of lRowCounter
 
Upvote 0
'With Application.Range(Cells(lRowCounter - 1, 1), Cells(lRowCounter, 1))
' .Merge
' .VerticalAlignment = xlCenter
' .HorizontalAlignment = xlCenter
'End With

OhhhhOhhhh..Sorry.
When coded that time i got this as reference.
I forget to remove.

Ok. As per your instruction, i will try and let u know abt that.
 
Upvote 0
Sir,

I got the error on this line only, from very starting.
Error
Compile error:
Wrong no. of arguments or Invalid property assignment
Range(Cells(fn, 5), Cells(fn, 6), Cells(fn, 7)).Merge = True

With Range(Cells(fn, 5), Cells(fn, 6), Cells(fn, 7))
.Merge
.Font.Bold = True
.HorizontalAlignment = xlCenter
End With

My final ans comes to this line.
 
Upvote 0
Several ways

Code:
With Union(Cells(fn, 5), Cells(fn, 6), Cells(fn, 7))
'or
With Range(Cells(fn, 5), Cells(fn, 7))
'or
With Cells(fn, 5).Resize(, 3)
 
Upvote 0

Forum statistics

Threads
1,224,507
Messages
6,179,183
Members
452,893
Latest member
denay

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