How to apply a formula or VBA to get a specific result in a row

maxrhino

New Member
Joined
Apr 14, 2013
Messages
5
Hi,

I have a excel spreadsheet that includes some dual numbers through a column like

2-1
6-4
8-0
.
.
.
and goes

<tbody>
</tbody>
My question is that how can I apply to get a specific result in next column. For example, if D3 2-1, then put a 1 into E3... Or if D3 2-2 (if two numbers are equal) put a T into E3... to make it simplier: If first number is bigger than the second one, put a Y into the next column, or second number is bigger than first one, then put a H... etc.... I need to apply the formula through all column, and have to point it again that, two numbers are in the same row, must not be separated, they are separated with a minus key.

Thanks for helps in advance.
 

Excel Facts

Which lookup functions find a value equal or greater than the lookup value?
MATCH uses -1 to find larger value (lookup table must be sorted ZA). XLOOKUP uses 1 to find values greater and does not need to be sorted.
If the numbers are one-digit numbers then use:

=IF(LEFT(A1;1)>RIGHT(A1;1);"Y";IF(LEFT(A1;1)<right(a1;1);"h";if(left(a1;1)=right(a1;1);"t")))


If you don't know how many digits the numbers have use:

</right(a1;1);"h";if(left(a1;1)=right(a1;1);"t")))
=IF(LEFT(A9;FIND("-";A9)-1)>RIGHT(A9;LEN(A9)-FIND("-";A9));"Y";IF(LEFT(A9;FIND("-";A9)-1)<RIGHT(A9;LEN(A9)-FIND("-";A9));"H";IF(LEFT(A9;FIND("-";A9)-1)=RIGHT(A9;LEN(A9)-FIND("-";A9));"T")))
 
Last edited:
Upvote 0
Thank you so much dulitul and Jeffrey20 for quick answers, however both formulas did not work, in fact I got error.
 
Upvote 0
Image isn't displayed, Jef.

For some weird reason the forum cuts my formulas :S

Here they are in an image:

f657d2f01991a6d05c992f32b777e4657e36312e.jpg
 
Upvote 0
Okay I managed to put the formula in a right way. Thank you so much Jeffrey, works like a charm and you made my day for this.
 
Upvote 0

Forum statistics

Threads
1,214,827
Messages
6,121,823
Members
449,049
Latest member
cybersurfer5000

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