Logical function help

susom

Board Regular
Joined
Aug 3, 2011
Messages
55
Office Version
  1. 365
Platform
  1. Windows
In my problem, I have two variables I am comparing--A and B. I would like to create a function that compares A and B for 1 of 3 possible combinations. If A = B, I want a "" value returned; if A>B, I want "Upgrade" returned; and lastly, if A<B, I want "Downgrade" returned. I know this is a fairly simple nested logical function, but I've been struggling with it for about an hour and failed to get what I am looking for.....please help.
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Your last condition got chopped off, but one way is to use a nested if statement structured something like this:
Code:
=IF(A=B,"",IF(A>B,"Upgrade","whatever last condition was"))
Not that since if A is not equal to B, and if it is not greater than B, then we really don't have to check to see if it is less than B, as that is the only thing left it can be (other than an error, I suppose).
That is what we did not check the last condition.

Note, you didn't mention if you wanted a regular Excel formula or VBA. If VBA, please let us know.
 
Upvote 0
Perfect! I'm a bit tired today, and was struggling to figure it out. I was able to employ the construct you gave in the Excel formula. Thank you!
 
Upvote 0

Forum statistics

Threads
1,215,338
Messages
6,124,358
Members
449,155
Latest member
ravioli44

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