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.
 
I tried to copy and paste the formula you suggested, but for some reason it gives an error, Excel asks if I am trying to write a formula.
You need to change the , to ; as your separators
Any idea how I can do this?
I'm just going to work, I'll take a look when I get back in if @Fluff hasn't looked at it first
 
Upvote 0

Excel Facts

Easy bullets in Excel
If you have a numeric keypad, press Alt+7 on numeric keypad to type a bullet in Excel.
Try
Excel Formula:
=IF(ISNUMBER(XMATCH(B2;LARGE($B$2:$B$22;{1;3;5;7})));"A";"B")
 
Upvote 0
Try
Excel Formula:
=IF(ISNUMBER(XMATCH(B2;LARGE($B$2:$B$22;{1;3;5;7})));"A";"B")
Try
Excel Formula:
=IF(ISNUMBER(XMATCH(B2;LARGE($B$2:$B$22;{1;3;5;7})));"A";"B")
I replicated the formulas but the result seems inaccurate.

Notice that in column B, the number 5 is the second largest number, so it is outside the {1,3,5,7} formula match, so it should return "B", because it doesn't match.

The same mismatch occurs with number 3, 2 and 1. Only number 8 gives the correct result, which is "A".

Pasta1.xlsm
ABCD
1Original nameNumber before the first dot
28.0.png8A
38.0.png8A
45.0.png5A
53.0.png3B
62.0.png2A
71.0.png1B
Sheet1
Cell Formulas
RangeFormula
B2:B7B2=1*TEXTBEFORE(A2, ".")
D2:D7D2=IF(ISNUMBER(XMATCH(B2,LARGE($B$2:$B$22,{1;3;5;7}))),"A","B")
 
Upvote 0
The 5 is the 3rd largest number as you have two values of 8
 
Upvote 0
The 5 is the 3rd largest number as you have two values of 8
Makes sense, is there any way around this? Because in my workflow I need that although equal numbers represent the same order. That is, both 8 numbers in the list should represent the first largest number, so as not to affect the rest of the result.
 
Upvote 0
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 the below what you require (if you copy the example using the
1690316734815.png
at the top of the XL2BB screenshot you'll probably find it will change the separators for you)?
I tried it in two ways, first I copied the formula directly into the example cell that you provided. Then I tried clicking the copy button of XL2BB.
Both ways failed, the first makes Excel ask me if I'm using a formula, the second makes the formulas not show any result.

So I copied the formulas manually and replaced " , " with " ; " .
VBA Code:
=IF(ISNUMBER(XMATCH(B2;LARGE(UNIQUE($B$2:$B$22);{1;3;5;7})));"A";"B")
So the formula worked perfectly

Is there any reason for this behavior?

Thanks a lot for the help and patience from you and all the members :)
 
Upvote 0
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

Forum statistics

Threads
1,215,330
Messages
6,124,307
Members
449,151
Latest member
JOOJ

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