ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Help with code (https://www.excelbanter.com/excel-programming/326752-help-code.html)

Greg[_20_]

Help with code
 
I am trying to write a code but I can't work out how to do it.


The code is

=if(a1=f1,"1",)

How do I add

=if(a1=f2,"2","")

Thanks in advance

Greg





Harald Staff

Help with code
 
Hi Greg

=IF(A1=F1,1,IF(A1=F2,2,0))
but if you want to further add f3, f4, f5 , ... then
=MATCH(A1,F1:F1000,0)
may be what you want

HTH. Best wishes Harald

"Greg" skrev i melding
...
I am trying to write a code but I can't work out how to do it.


The code is

=if(a1=f1,"1",)

How do I add

=if(a1=f2,"2","")

Thanks in advance

Greg







Greg[_20_]

Help with code
 
Thank you for that

Works great

Greg




All times are GMT +1. The time now is 12:01 AM.

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