ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   if function (https://www.excelbanter.com/new-users-excel/169277-if-function.html)

neilb514

if function
 
Hi
I need to do a basic if function. in cell A1 it may say "14" so in cell A2 I
want to display another number ie "1", If A1 has changed to "18" I want A2 to
display "2", If A1 changes again I need to display "3" etc. I need five
changes all told, and I havn't got a clue. Any help will be appretiated.

Sandy Mann

if function
 
Are they specific sets of numbers? I mean will A1 contain only ever 14, 18
......whatever the rest of the numbers are or do you mean *ANY* change of A1
index A2 up one. If the former then try:

=IF(A1=14,1,IF(A1=18,2,IF(A1=22,3,IF(A1=26,4,IF(A1 =30,5,"")))))

or if you mean "up to 14", "more then 14 and up to 18" then try:

=IF(A126,5,IF(A122,4,IF(A118,3,IF(A114,2,IF(A1 0,1,"")))))

If you mean *any* change then you will need VBA.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"neilb514" wrote in message
...
Hi
I need to do a basic if function. in cell A1 it may say "14" so in cell A2
I
want to display another number ie "1", If A1 has changed to "18" I want A2
to
display "2", If A1 changes again I need to display "3" etc. I need five
changes all told, and I havn't got a clue. Any help will be appretiated.




neilb514

if function
 

Hello
Many thanks, your second example works perfect.
neilb514

"Sandy Mann" wrote:

Are they specific sets of numbers? I mean will A1 contain only ever 14, 18
......whatever the rest of the numbers are or do you mean *ANY* change of A1
index A2 up one. If the former then try:

=IF(A1=14,1,IF(A1=18,2,IF(A1=22,3,IF(A1=26,4,IF(A1 =30,5,"")))))

or if you mean "up to 14", "more then 14 and up to 18" then try:

=IF(A126,5,IF(A122,4,IF(A118,3,IF(A114,2,IF(A1 0,1,"")))))

If you mean *any* change then you will need VBA.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"neilb514" wrote in message
...
Hi
I need to do a basic if function. in cell A1 it may say "14" so in cell A2
I
want to display another number ie "1", If A1 has changed to "18" I want A2
to
display "2", If A1 changes again I need to display "3" etc. I need five
changes all told, and I havn't got a clue. Any help will be appretiated.





Sandy Mann

if function
 
Glad that it worked for you. Thanks for the feedback.

--
Regards,

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"neilb514" wrote in message
...

Hello
Many thanks, your second example works perfect.
neilb514

"Sandy Mann" wrote:

Are they specific sets of numbers? I mean will A1 contain only ever 14,
18
......whatever the rest of the numbers are or do you mean *ANY* change of
A1
index A2 up one. If the former then try:

=IF(A1=14,1,IF(A1=18,2,IF(A1=22,3,IF(A1=26,4,IF(A1 =30,5,"")))))

or if you mean "up to 14", "more then 14 and up to 18" then try:

=IF(A126,5,IF(A122,4,IF(A118,3,IF(A114,2,IF(A1 0,1,"")))))

If you mean *any* change then you will need VBA.

--
HTH

Sandy
In Perth, the ancient capital of Scotland
and the crowning place of kings


Replace @mailinator.com with @tiscali.co.uk


"neilb514" wrote in message
...
Hi
I need to do a basic if function. in cell A1 it may say "14" so in cell
A2
I
want to display another number ie "1", If A1 has changed to "18" I want
A2
to
display "2", If A1 changes again I need to display "3" etc. I need
five
changes all told, and I havn't got a clue. Any help will be
appretiated.









All times are GMT +1. The time now is 01:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com