Link to "<" or ">" in an excel formula

tscski28

New Member
Joined
May 8, 2019
Messages
2
Hi, I have a formula that says =if(A1>A2,"True","False"). However, I want the ability for the user to change the sign in an other cell. So let's say in cell B1 they can enter ">" or "<". I want to write a formula something like this =if(A1&B1&A2,"True","False"). This does not work. How can I do this?
 

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Welcome to the Board.

There's really no good way to do this, but there are several options. You could come up with a more complicated formula, like this:

=IF(AND(B1="<",A1< A2),"True",IF(AND(B1=">",A1>A2),"True","False"))

You could use COUNTIF like this:

=IF(COUNTIF(A1,B1&A2),"True","False")

Or you could use the EVALUATE function which requires some heroic efforts using the Name Manager, and turns your workbook into a macro-enabled workbook.

Or you could actually write a User-Defined Function in VBA which would be easiest to understand.

Let us know if any of these ideas work for you.
 
Last edited:
Upvote 0
Thanks so much for the quick response. I was worried this might be the case. Thanks for the helpful suggestions.
 
Upvote 0

Forum statistics

Threads
1,223,704
Messages
6,173,984
Members
452,540
Latest member
haasro02

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