#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Test 2 numbers

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default Test 2 numbers

Hi,

In cell C2, you can use the formula

=If(a1=b1,2,1)

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Dave" wrote in message
...
Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to
return
1 or if the numbers are the same 2


d


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Test 2 numbers

=IF(A1=B1,2,1)
--
Gary''s Student - gsnu200832


"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d

  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Test 2 numbers

Hi,

A couple of ways

=DELTA(A1,B1)+1

or

=(A1=B1)*1+1

Mike



"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d

  #5   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Test 2 numbers

I should have mentioned that if you use DELTA and get a name error then

Tools|Addins and check the analysis toolpak

re-enter the formula

Mike

"Mike H" wrote:

Hi,

A couple of ways

=DELTA(A1,B1)+1

or

=(A1=B1)*1+1

Mike



"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d



  #6   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,718
Default Test 2 numbers

=COUNTIF(A1:B1,A1)


"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d

  #7   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Test 2 numbers

Thank you

"Ashish Mathur" wrote:

Hi,

In cell C2, you can use the formula

=If(a1=b1,2,1)

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Dave" wrote in message
...
Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to
return
1 or if the numbers are the same 2


d


  #8   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Test 2 numbers

Thank you

"Gary''s Student" wrote:

=IF(A1=B1,2,1)
--
Gary''s Student - gsnu200832


"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d

  #9   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Test 2 numbers

Thank you

"Mike H" wrote:

Hi,

A couple of ways

=DELTA(A1,B1)+1

or

=(A1=B1)*1+1

Mike



"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d

  #10   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,388
Default Test 2 numbers

Thank you

"Teethless mama" wrote:

=COUNTIF(A1:B1,A1)


"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d



  #11   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 1,766
Default Test 2 numbers

You are welcome

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Ashish Mathur" wrote in message
...
Hi,

In cell C2, you can use the formula

=If(a1=b1,2,1)

--
Regards,

Ashish Mathur
Microsoft Excel MVP
www.ashishmathur.com

"Dave" wrote in message
...
Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to
return
1 or if the numbers are the same 2


d


  #12   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Test 2 numbers

On Sat, 7 Feb 2009 04:27:02 -0800, Dave wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d


=1+(A1=B1)
--ron
  #13   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Test 2 numbers

On Sat, 7 Feb 2009 04:38:01 -0800, Mike H
wrote:

=(A1=B1)*1+1


The *1 seems to be superfluous.

=(A1=B1)+1



--ron
  #14   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Test 2 numbers

Ron,

I had a mindset about changing false/true to 0 or 1 and then adding the 1
the OP wanted and failed to realise the +1 would do both jobs.

Thanks for pointing that out.

Mike

"Ron Rosenfeld" wrote:

On Sat, 7 Feb 2009 04:38:01 -0800, Mike H
wrote:

=(A1=B1)*1+1


The *1 seems to be superfluous.

=(A1=B1)+1



--ron

  #15   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Test 2 numbers

Hi,

One advantage in using COUNTIF is that it will work for Text, Numbers, or
Dates

One advantage in using =1+(A1=A2) or DELTA is that the cells don't need to
be adjactent, but both of these don't work for text.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d



  #16   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 15,768
Default Test 2 numbers

using =1+(A1=A2) or DELTA
but both of these don't work for text.


=1+(A1=A2)

Does work with text.

--
Biff
Microsoft Excel MVP


"Shane Devenshire" wrote in
message ...
Hi,

One advantage in using COUNTIF is that it will work for Text, Numbers, or
Dates

One advantage in using =1+(A1=A2) or DELTA is that the cells don't need to
be adjactent, but both of these don't work for text.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to
return
1 or if the numbers are the same 2


d



  #17   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 5,651
Default Test 2 numbers

On Sat, 7 Feb 2009 09:34:01 -0800, Shane Devenshire
wrote:

One advantage in using =1+(A1=A2) or DELTA is that the cells don't need to
be adjactent, but both of these don't work for text.


I'm not sure about your English. Maybe the difference between GB and the
colonies?

When you write "both of these don't work for text", some would take that to
mean that "neither" of these equations work for text.

I believe it would be useful to point out that the first equation works for
text or numbers, and the second only works for numbers.

And to be complete, the first is not case-sensitive when applied to text. A
case-sensitive variation, which would work for both text and numbers, would be:

=exact(a1,a2)+1

--ron
  #18   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,501
Default Test 2 numbers

Shane,

You missed a major disadvantage of DELTA is that it can only take 2
arguments and would become more trouble than it's worth with the fiddling
about you'd have to do when trying to evaluate more than 2. The only reason I
offered it was because th OP specified 2 numbers.

We'll disagree about whether =(A1=B1)+1 can handle text, I remain of the
opinion it can :)

Mike




"Shane Devenshire" wrote:

Hi,

One advantage in using COUNTIF is that it will work for Text, Numbers, or
Dates

One advantage in using =1+(A1=A2) or DELTA is that the cells don't need to
be adjactent, but both of these don't work for text.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d

  #19   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 3,346
Default Test 2 numbers

Hi all

We don't have to disagree on whether the first one will work with text, I
was a little fast on the draw, it does work for text.

And I like the additional point about the limits of DELTA. But I was glad
to see someone find a use for DELTA, I sure there are others but it usually
seems a little longer that other solutions.

Cheers,
Shane Devenshire


"Mike H" wrote:

Shane,

You missed a major disadvantage of DELTA is that it can only take 2
arguments and would become more trouble than it's worth with the fiddling
about you'd have to do when trying to evaluate more than 2. The only reason I
offered it was because th OP specified 2 numbers.

We'll disagree about whether =(A1=B1)+1 can handle text, I remain of the
opinion it can :)

Mike




"Shane Devenshire" wrote:

Hi,

One advantage in using COUNTIF is that it will work for Text, Numbers, or
Dates

One advantage in using =1+(A1=A2) or DELTA is that the cells don't need to
be adjactent, but both of these don't work for text.

--
If this helps, please click the Yes button

Cheers,
Shane Devenshire


"Dave" wrote:

Hello,

two number in (say) a1 & b1

In another cell If the numbers are different how can i get Excel to return
1 or if the numbers are the same 2


d

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
TEST TEST robert morris Excel Discussion (Misc queries) 0 April 28th 08 07:28 PM
Converting test to numbers and adding into a summary page Laura Excel Worksheet Functions 1 September 7th 06 04:24 PM
Calculate mean of test scores from rows of test answers RiotLoadTime Excel Discussion (Misc queries) 1 July 26th 06 05:14 PM
logical test, array, text and numbers Dan M. Excel Worksheet Functions 1 April 25th 06 08:56 AM
test..where are my messages..test HT New Users to Excel 0 January 23rd 05 06:23 PM


All times are GMT +1. The time now is 10:19 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"