Formula does not work if it refers to a cell that contains a number that is the result of a formula

SunValley

New Member
Joined
Jul 12, 2023
Messages
45
Office Version
  1. 365
Platform
  1. Windows
I am using the following formula
=IF(B2=LARGE(B2:B22;1);"A";"B")

The formula works fine if the cells being referenced contain numbers, but if the numbers in those cells are the result of a formula then things don't work.
 

Excel Facts

Best way to learn Power Query?
Read M is for (Data) Monkey book by Ken Puls and Miguel Escobar. It is the complete guide to Power Query.
Your issue is the cells in B2:B22 contain text as in TEXTbefore.
Try this:
Code:
=1*TEXTBEFORE(A2,".")
Assuming you KNOW that the characters before the period are all numbers.
 
Upvote 1
Solution
Is the below what you require (if you copy and paste with Ctrl + V the example using the
1690316734815.png
at the top of the XL2BB screenshot for the copy you'll probably find it will change the separators for you)?

Book1.xlsb
ABCD
1Original nameNumber before the first dot
28.0.png8A
38.0.png8A
45.0.png5B
53.0.png3A
62.0.png2B
71.0.png1A
Sheet3
Cell Formulas
RangeFormula
B2:B7B2=1*TEXTBEFORE(A2, ".")
D2:D7D2=IF(ISNUMBER(XMATCH(B2,LARGE(UNIQUE($B$2:$B$22),{1;3;5;7}))),"A","B")
 
Upvote 1
Is there any reason for this behavior?
Yes, your regional list separator is ; rather than , which mine and fluff's are. The list separator is normally a , in the USA and UK (where both myself and fluff are based).
What your setting is dependent on what country your Windows settings are for.


 
Upvote 1
I don't have an issue w/it when I use the English separator of a comma vs a semi-colon. Maybe show your data using XL2BB.
 
Upvote 0
Works fine for me when B2:B22 holds this formula:
Excel Formula:
=RANDBETWEEN(1,100)
 
Upvote 0
I don't have an issue w/it when I use the English separator of a comma vs a semi-colon. Maybe show your data using XL2BB.
I am using the formula =TEXTBEFORE(A2; ".") in B2:B22
But when using a simpler formula in B2:B22, such as adding two cells, then the formula =TEXTBEFORE(A2; ".") works normally
 
Upvote 0
Your issue is the cells in B2:B22 contain text as in TEXTbefore.
Try this:
Code:
=1*TEXTBEFORE(A2,".")
Assuming you KNOW that the characters before the period are all numbers.
Thank you very much, it worked perfectly :)
Thanks also to JoeMo for trying to help :)
 
Upvote 0
Sorry to reactivate the topic. I'm trying a variation of the formula =IF(B2=LARGE(B2:B22;1);"A";"B")
to check if the mentioned cell is also part of the first, second or third largest number =IF(B3=LARGE(B2:B22;{1,2,3});"A";"B")

However, Excel tries to correct the formula for something other than my purpose. When denying the correction, it is reported as an error.
 

Attachments

  • Screenshot 2023-07-24 151954.png
    Screenshot 2023-07-24 151954.png
    11.9 KB · Views: 3
  • Screenshot 2023-07-24 152119.png
    Screenshot 2023-07-24 152119.png
    15.1 KB · Views: 4
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,706
Members
449,464
Latest member
againofsoul

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