473,324 Members | 1,646 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,324 software developers and data experts.

How to replace the 4 individual cell selections in a UDF with 2 ranges and complete t

Hello,

I've gotten good at nesting formulas to the point that I need to start using UDF's.

Function Dist(XA As Double, YA As Double, XB As Double, YB As Double)
Dist = Sqr((YA - YB) ^ 2 + (XA - XB) ^ 2)
End Function


I think the function would be improved by using

Function Dist(PT1 As Range, PT2 As Range)

PT1 would contain an X,Y coordinate with PT2 containing a second. The UDF would make this monster much easier to manage.

=IF(BV15="","",IF(IF(SQRT(POWER(AL$21-BT15,2)+POWER(AK$21-BS15,2))<SQRT(POWER(AL$21-(BP15),2)+POWER(AK$21-BO15,2)),AL$22,AK$22)=AL$22,IF(SQRT((POWER((BL15-BP15),2)+POWER(BK15-BO15,2)))<SQRT(POWER(BL15-BR15,2)+POWER((BK15-BQ15),2)),BU15,BS15),IF(SQRT(POWER(BL15-BV15,2)+POWER(BK15-BU15,2))<SQRT(POWER(BL15-BT15,2)+POWER(BK15-BS15,2)),BO15,BQ15)))

Best Regards,

Jay
Aug 26 '10 #1
0 735

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: Harry | last post by:
I would like to have just the top row cells of a table to have borders - is this possible/easy? or do I have to make the title row another table? thanks harry
9
by: Paul | last post by:
Hi I have a data grid with a hyperlink column. the colum has numbers like 00001,000002, ect. Just wondering how to get the text value of the cell as tempstring =...
0
by: Roy | last post by:
What is the best way to approach this problem? I have a datagrid with an imagebutton. When one clicks the imagebutton it triggers an onClick sub which makes column 9 (a user control) visible or...
6
by: guffe | last post by:
I'm trying to display data in a datagrid. The rows are hours of the day and the coloums are days of the week. I need individual cell hight to display that a task takes more than one hour. How can it...
1
by: Lonewolf | last post by:
hi all, just want to find out if it is possible to set the gridline of individual cell in a listview using C#. Reason for this is I need to have a listview which has fixed number of columns and...
10
by: steve | last post by:
Hi All I would like to be able to change the cell borders on certain cells to none at runtime to make a group of cells appear to be merged I have tried the following in the cellformatting...
3
by: RichT | last post by:
Hi all, I am experiencing some odd behaviour with a DataGridView. The DataGridView is bound to a DataTable, which is populated with data from a csv file. The column Headings appear fine,...
1
by: K B | last post by:
I would like to create a gridview as below: Project Name 1-1 1-2 1-3 1-4 1-5 1-6 Project 1 BLUE BLUE BLUE BLUE GREEN GREEN more projects I would like to fill the...
0
by: DanThMan | last post by:
I'm really getting frustrated with GridView is WPF. All I want is to allow users to select an individual cell instead of a whole row, but that was left out of the object model for some reason....
2
by: omar999 | last post by:
hi guys I hope the thread title is self explanatory but im basically I've got a rather large ms sql table which is populated with data taken from an excel spreadsheet. Problem is that there are...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.