Welcome to Tech Support Forum home to more then 136,000 problems solved. Issues have included: Spyware, Malware, Virus Issues, Windows, Microsoft, Linux, Networking, Security, Hardware, and Gaming Getting your problem solved is as easy as:
1. Registering for a free account
2. Asking your question
3. Receiving an answer

Registered members:
* Get free support
* Communicate privately with other members (PM).
* Removal of this message
* See fewer ads.
* And much more..

 



Want to know how to post a question? click here Having problems with spyware and pop-ups? First Steps
Go Back   Tech Support Forum > Microsoft Support > Microsoft Office support
User Name
Password
Site Map Register Donate Rules Blogs Mark Forums Read


Microsoft Office support MS Office support forum

Reply
 
LinkBack Thread Tools
Old 05-30-2005, 09:51 AM   #1 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


Excel formula help

Please see the Attachment, and open as an excel file.
Two formula is selecting the lowest price and then selecting the vendor of the lowest price.

So far if there is no price for one of the vendors for eg, the formula does not work, and if I put a zero in, it selects the zero as best price and vendor.

How can I tell the formula to select the best price but if it shows blank or zero to goto the next lowest price?

Hope I have explained it ok
Attached Files
File Type: txt Book2.txt (13.5 KB, 11 views)
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Important Information
Join the #1 Tech Support Forum Today - It's Totally Free!

TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free.

Join TechSupportforum.com Today - Click Here

Old 05-31-2005, 05:05 AM   #2 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

I've gotta say that a custom function would do the trick much better than cell-formulising it. It's ok with 2 vendors, painfully messy with three and almost impossible to code with 4 if you just code it in the cell. With three vendors, you'll need 7 IF statements (nested to level three) and with 4 vendors, you need a whopping 15 IF statements in the formula.

Give me a couple of hours and I'll try to make a function for you to put in, but here's some example pseudo-code for doing it the cell-formulaic way.

Code:
IF 1 IS BLANK
    IF 2 IS BLANK
        IF 3 IS BLANK
            "No Vendors"
            V3
        IF 3 IS BLANK
            V2
            MIN: V2, V3
    IF 2 IS BLANK
        IF 3 IS BLANK
            V1
            MIN: V1, V3
        IF 3 IS BLANK
            MIN: V1, V2
            MIN: V1, V2, V3
btw, the IF BLANK would also include the value being 0.
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2005, 07:40 AM   #3 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

OK, turns out I practically did the same in a VBA formula, but it's easier to read and you can use it to find the minimum of any three, non zero cells - all you need to do is tell it which cells.

Updated file is attached - not sure why, but it seems to need the ROUND function to allow it to compare the min value to the absolute values - likely it's just a rounding error in the computer on turning decimal to binary and back.

Hope this helps!
Attached Files
File Type: txt Book2.txt (24.0 KB, 9 views)
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."

Last edited by ReeKorl; 05-31-2005 at 07:40 AM. Reason: again, it would help if I attached the file... d'oh!
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2005, 09:11 AM   #4 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


Thanks, just got in now and opening it up. Interesting name "ReeKorl", does it mean anything, I am assuming so.

S

Where in the main VBA script shall I place this script, in the front end or inside the other main one?

Last edited by 00Seven; 05-31-2005 at 09:16 AM.
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2005, 09:32 AM   #5 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

As long as the code is intact (ie from Function... to ...End Function) you can put it anywhere in the existing module (as long as it isn't inside the sub), so it'll probably be best to copy the text (except for the Option Explicit line), and paste it all after the "End Sub" in the existing module.

As a matter of fact, ReeKorl doesn't actually mean anything in itself - but it has evolved partially as a joke and partially as a description of me. It's the literal pronunciation of the word "recall". Basically, I have a very good memory for numerics, technical details and strategies/tactics, etc, but ask me what I had for breakfast and I'm lost.

I've also found it works very well as an online handle, as I haven't come across anyone in over 8 years who uses the same name.
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."

Last edited by ReeKorl; 05-31-2005 at 09:33 AM.
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2005, 10:20 AM   #6 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


It works very well. It sure is a complicated. I have been looking up some VBA and reasearching, but Rome was not built in a day.

When there is no value in all three I get a # VALUE! error. But I think I can live with that and play around with it.

Thanks again ReeKorl
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2005, 10:28 AM   #7 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

No problem.

The #VALUE! can be avoided easily. In the cell with the formula, simply put this function:

Code:
=IF(ISERROR(ROUND(ls3(E9,F9,G9),2)),"",ROUND(ls3(E9,F9,G9),2))
Note that the text in blue is the original fomula. This says if the value of the formula is an error, put a blank, otherwise put the actual value.
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 05-31-2005, 11:09 AM   #8 (permalink)
Member
 
00Seven's Avatar
 
Join Date: May 2005
Location: South Carolina
Posts: 38
OS: WinXP


Thanks again.

Is programming your specialty or are you an all round Computer wizard?
00Seven is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Old 06-01-2005, 01:30 AM   #9 (permalink)
Superhuman Computer
 
ReeKorl's Avatar
 
Join Date: Mar 2005
Location: 6th Circle, The City of Dis, Hell
Posts: 1,610
OS: WinXP Pro SP2

My System

Glad to have helped!

All round normally, but I've worked for the past 8 months programming excel spreadsheets to calculate pensions for a large company, so I've got a lot of recent experience with excel.
__________________
"Sorry, the number you have dialled is imaginary. Please rotate dial by 90 degrees and try again."
ReeKorl is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!Reddit!
Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT -7. The time now is 09:17 PM.



Copyright 2001 - 2009, Tech Support Forum
Home Tips Plus | Outdoor Basecamp | Automotive Support Forum

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85