Hi
I've got three formulae that work in isolation, but not together.
If the text "4 for 10" is in cell A1, I'd like one formula that returns the text "Multi deal where X<Y" if 4 is greater than 10, which it is. But returns "Multi deal where X>Y"if the text in cell A2 was 10 for 4.
The formulae which work in isolation are as follows:
This formula in cell B1 returns the word "for" if that text is in A1:
=IF(ISNUMBER(SEARCH("for",A1)),"For","")
This formula returns the first number on the left of A1 (if it has the word "for")
=RIGHT(TRIM(LEFT(A1,SEARCH("for",A1)-1)),2)
This formula returns the number on the right of the cell (if it has the word "for")
=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),100))
But when I combine them together, I get an error message.
Eg this should return "Multi deal where X <Y" but it doesn't (if this formula is in cell D1). Does anyone know the solution, please?
=IF(and((ISNUMBER(SEARCH("for",A1)),"For",RIGHT(TRIM(LEFT(A1,SEARCH("for",A1)-1)),2)>TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),100))),"Multi Deal where X>Y",IF(and((ISNUMBER(SEARCH("for",A1)),"For",RIGHT(TRIM(LEFT(A1,SEARCH("for",A1)-1)),2)<TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),100))),"Multi Deal where X<Y",""))))
I've got three formulae that work in isolation, but not together.
If the text "4 for 10" is in cell A1, I'd like one formula that returns the text "Multi deal where X<Y" if 4 is greater than 10, which it is. But returns "Multi deal where X>Y"if the text in cell A2 was 10 for 4.
The formulae which work in isolation are as follows:
This formula in cell B1 returns the word "for" if that text is in A1:
=IF(ISNUMBER(SEARCH("for",A1)),"For","")
This formula returns the first number on the left of A1 (if it has the word "for")
=RIGHT(TRIM(LEFT(A1,SEARCH("for",A1)-1)),2)
This formula returns the number on the right of the cell (if it has the word "for")
=TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),100))
But when I combine them together, I get an error message.
Eg this should return "Multi deal where X <Y" but it doesn't (if this formula is in cell D1). Does anyone know the solution, please?
=IF(and((ISNUMBER(SEARCH("for",A1)),"For",RIGHT(TRIM(LEFT(A1,SEARCH("for",A1)-1)),2)>TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),100))),"Multi Deal where X>Y",IF(and((ISNUMBER(SEARCH("for",A1)),"For",RIGHT(TRIM(LEFT(A1,SEARCH("for",A1)-1)),2)<TRIM(RIGHT(SUBSTITUTE(A1," ",REPT(" ",100)),100))),"Multi Deal where X<Y",""))))