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

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
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.
 
Upvote 1
Solution
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: 2
  • Screenshot 2023-07-24 152119.png
    Screenshot 2023-07-24 152119.png
    15.1 KB · Views: 3
Upvote 0
Try
Excel Formula:
=IF(B3>=LARGE(B2:B22;3);"A";"B")
 
Upvote 0
Try
Excel Formula:
=IF(B3>=LARGE(B2:B22;3);"A";"B")
It does not show the correct result.

The goal is to check if cell B2 is part of the first, second or third largest number in the range B2:B22.

Furthermore, I realize that in the previous formula where I mentioned =IF(B2=LARGE(B2:B22;1);"A";"B") , there was a need for the number of numbers mentioned in the formula to present a result.

For example, if I try =IF(B2=LARGE(B2:B22;5);"A";"B") it checks if cell B2 matches the fifth largest number in the range B2:B22. However, if in the range B2:B22 there are only 4 filled cells instead of 5, the formula returns #NUM!, when it should return B, since cell B2 is not part of the fifth largest number (although this fifth number does not exist in the range B2:B22.
 
Upvote 0

Forum statistics

Threads
1,215,328
Messages
6,124,299
Members
449,149
Latest member
mwdbActuary

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