Add the number to True

sksanjeev786

Well-known Member
Joined
Aug 5, 2020
Messages
994
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Hi Team

I need a number ranking on column N4 to N9 so where ever i have True I need data num 2 (N4+1) and false will have same number and next true it will 4 since 2 number came twice see the output in column O

TD Macro.xlsm
ABCDEFGHIJKLMNOP
3Output
4ATD Bank1717BBank of America55 ACDEF55111
5BBank of America55 ACDEF55EChase38 ACD387TRUE2
6CCapital One2323FWells Fargo33 ACD33#VALUE!FALSE2Same Number
7DCitibank2020CCapital One23235TRUE4
8EChase38 ACD38DCitibank2020#VALUE!FALSE4Same Number
9FWells Fargo33 ACD33ATD Bank1717#VALUE!FALSE4Same Number
Sheet2 (3)
Cell Formulas
RangeFormula
H4:K9H4=CHOOSECOLS(SORTBY(A4:G9,G4:G9,-1),1,2,3,7)
M5:M9M5=SEARCH(H5,J4)
N5:N9N5=ISNUMBER(SEARCH(H5,J4))
G4:G9G4=VALUE(IFERROR(LEFT(C4,2),LEFT(C4,1)))
Dynamic array formulas.
 

Excel Facts

Lock one reference in a formula
Need 1 part of a formula to always point to the same range? use $ signs: $V$2:$Z$99 will always point to V2:Z99, even after copying
Why is O7 4 instead of 3?
Wouldn't 3 be the next number after 2?
 
Upvote 0
Why is O7 4 instead of 3?
Wouldn't 3 be the next number after 2?

Hi Joe,

If it is False then the number will be the same as True with above cell number and next True is coming in row 4 so it will be 4 and False will remain same number
 
Upvote 0
OK, then assuming that you have a "1" in cell O4 to start, put this formula in cell O5 and copy down:
Excel Formula:
=IF(N5=FALSE,O4,COUNTA(N$4:N5))
 
Upvote 1
Solution
OK, then assuming that you have a "1" in cell O4 to start, put this formula in cell O5 and copy down:
Excel Formula:
=IF(N5=FALSE,O4,COUNTA(N$4:N5))
Thanks you Joe:)

it is working fine for now but will let you know if I need any further assistance.:)

Regards
Sanjeev
 
Upvote 0
You are welcome!
Glad I was able to help.

By the way, here is another option that you can put in O4 and copy all the down (so you don't need to put a 1 in the first cell to start).
Excel Formula:
=IF(N4=FALSE,O3,ROW()-3)
 
Upvote 0
Tha
You are welcome!
Glad I was able to help.

By the way, here is another option that you can put in O4 and copy all the down (so you don't need to put a 1 in the first cell to start).
Excel Formula:
=IF(N4=FALSE,O3,ROW()-3)
Sure! thanks Joe :)
 
Upvote 0
Tha

Sure! thanks Joe :)
Hi Joe,

I have applied your formula but looks like i am getting a slightly different score My data is in column E and Formula data in Column H
but in cell E12 and E18 I am getting ranking different logic are applied in column G

Can we tweak in logic so that I can get same result like Colum E

TD Macro.xlsm
ABCDEFGHIJ
1Actual outputFormula Output
2BBank of America55 ACDEF55111TRUE
3EChase38 ACD382TRUE2TRUE
4FWells Fargo33 ACD332FALSE2TRUE
5CCapital One23234TRUE4TRUE
6DCitibank20204FALSE4TRUE
7ATD Bank17174FALSE4TRUE
8
9CCapital One52 ADF52111TRUE
10BBank of America48 AD481FALSE1TRUE
11EChase48 AD481FALSE1TRUE
12FWells Fargo42 AD424FALSE1FALSE
13ATD Bank32325TRUE5TRUE
14DCitibank31315FALSE5TRUE
15
16BBank of America60 ACDE60111TRUE
17FWells Fargo53 ACD531FALSE1TRUE
18EChase45 ACD453FALSE1FALSE
19DCitibank23234TRUE4TRUE
20CCapital One22224FALSE4TRUE
21ATD Bank20204FALSE4TRUE
22
23CCapital One57 AD57111TRUE
24EChase57 AD571FALSE1TRUE
25FWells Fargo55 AD551FALSE1TRUE
26BBank of America54 AD541FALSE1TRUE
27ATD Bank39395TRUE5TRUE
28DCitibank36365FALSE5TRUE
Data
Cell Formulas
RangeFormula
G3:G7,G24:G28,G17:G21,G11:G14G3=ISNUMBER(SEARCH(A3,C2))
H3:H7H3=IF(G3=FALSE,H2,COUNTA(G$3:G4))
J2:J7,J23:J28,J16:J21,J9:J14J2=E2=H2
G10G10=ISNUMBER(SEARCH(A9,C9))
H10:H14H10=IF(G10=FALSE,H9,COUNTA(G$10:G11))
H17:H21H17=IF(G17=FALSE,H16,COUNTA(G$17:G18))
H24:H28H24=IF(G24=FALSE,H23,COUNTA(G$24:G25))
Cells with Conditional Formatting
CellConditionCell FormatStop If True
J2:J28Cell Valuecontains "f"textNO
G23:G28Cell Valuecontains "True"textNO
G16:G21Cell Valuecontains "True"textNO
G9:G14Cell Valuecontains "True"textNO
G2:G7Cell Valuecontains "True"textNO
 
Upvote 0
I am confused as to what you are telling me - you do not appear to have any formulas in column E at all. Those appear to be hard-coded, not the results of my formula.
What should the values in cells E12 and E18 be?
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,183
Members
452,615
Latest member
bogeys2birdies

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