Update formula criteria

webbooo

New Member
Joined
Nov 8, 2011
Messages
19
hello everyone,

I hve the following formaul in excel

=COUNTIF($A3,Sheet2!$A$14)+COUNTIF($A3,Sheet2!$B$14)+COUNTIF($A3,Sheet2!$C$14)+COUNTIF($A3,Sheet2!$D$14)+COUNTIF($A3,Sheet2!$E$14)+COUNTIF($A3,Sheet2!$F$14)

the problem I have is I would like to copy this formula into another column and change each reference to 14 to 15. I can do this manually but given I will potentially be coping the formula into 100's of cells each time doing it manually wouold take me ages.

I tried the obvious and changed the $A$14 TO $A14 but this wont change when moving formaul accross only when you move it down. The "$A" is OK being locked and the rest of the formula I'm ok with.

Does anyone have any suggestion, Its almost like each time the formula is copied the criteria cells need to add a digit.

any help would be mich appreciated, I'm not that familiar with vba but open to any suggestions

thanks for any assiatance

Me

:)
 

Excel Facts

Spell Check in Excel
Press F7 to start spell check in Excel. Be careful, by default, Excel does not check Capitalized Werds (whoops)
You can find $14 & replace it with $15

- copy the formula at the column you desire

- select the copied range

- press ctrl + h

- type $14 at find field and $15 at replace field

- press ok

This will replace 14 as 15 in one shot
 
Upvote 0
Thanks for the response's

Harsh31412, that does work thank you. It does require manual intervention to enter the find/replace criteria and would like to be able to automate it as much as possible. Doing that 100+ times would be painfull :)

mmodroger, your didnt seem to return any value, just 0 which isnt correct? are you able to break this down maybe I'm doing something wrong?

as an example, my sheet has over 200 names on sheet 1, the formula i have going into D3 as below is
"B]=COUNTIF($A3,Sheet2!$A$14)+COUNTIF($A3,Sheet2!$B$14)+COUNTIF($A3,Sheet2!$C$14)+COUNTIF($A3,Sheet2!$D$14)+COUNTIF($A3,Sheet2!$E$14)+COUNTIF($A3,Sheet2!$F$14)[/B]" -

If I fill this formula down it returns a 1 in the cells that had a match, which work fine. So D6,D17,D11,D5,D16,D10 all return a 1, other cells return 0.

I now need to copy the formula to D4 and drill down. If I do it the results are the same as I need to change the criteria from Sheet2 A14 to Sheet2 A15 and then repeat the process for the next column etc

Sheet 1

A3:Dave
A4:Alex
A5:Same
A6:Roger
A7:Glen
A8:Mark
A9:Simon
A10:Michael
A11:Susan
A12:Romeo
A13:Nona
A14:Olivia
A15:Jack
A16:Alf
A17:Bev

Sheet2
A14:Roger B14:Bev C14:Susan D14:Same E14:Alf F14:Michael
A15:Glen B15:Susan C15:Mark D15:Simon E15:Jack F15:Olivia
etc
etc

I hope this clarifies it,

thanks again

:)
 
Upvote 0
try this and see if it works in your sheet.
Excel Workbook
ABCDE
4Dave00
5Alex00
6Same10
7Roger
8Glen
9Mark
10Simon
11Michael
12Susan
13Romeo
14Nona
15Olivia
16Jack
17Alf
18Bev
Sheet1
Excel 2007
Cell Formulas
RangeFormula
D4=SUMPRODUCT(--(INDIRECT("Sheet2!$A$"&(14+COLUMNS($D$4:D4)-1)&":$F$"&(14+COLUMNS($D$4:D4)-1))=Sheet1!$A4))
D5=SUMPRODUCT(--(INDIRECT("Sheet2!$A$"&(14+COLUMNS($D$4:D5)-1)&":$F$"&(14+COLUMNS($D$4:D5)-1))=Sheet1!$A5))
D6=SUMPRODUCT(--(INDIRECT("Sheet2!$A$"&(14+COLUMNS($D$4:D6)-1)&":$F$"&(14+COLUMNS($D$4:D6)-1))=Sheet1!$A6))
E4=SUMPRODUCT(--(INDIRECT("Sheet2!$A$"&(14+COLUMNS($D$4:E4)-1)&":$F$"&(14+COLUMNS($D$4:E4)-1))=Sheet1!$A4))
E5=SUMPRODUCT(--(INDIRECT("Sheet2!$A$"&(14+COLUMNS($D$4:E5)-1)&":$F$"&(14+COLUMNS($D$4:E5)-1))=Sheet1!$A5))
E6=SUMPRODUCT(--(INDIRECT("Sheet2!$A$"&(14+COLUMNS($D$4:E6)-1)&":$F$"&(14+COLUMNS($D$4:E6)-1))=Sheet1!$A6))
 
Upvote 0
mmodroger, that worked :)

thank you very much you are a genius, dunno how that formula actually works but it does the job

really appreciate your help

thankyou!

:)
 
Upvote 0
thanks for the feedback. Indirect function is a great formula and you should learn it sometimes :)
 
Upvote 0

Forum statistics

Threads
1,216,116
Messages
6,128,926
Members
449,479
Latest member
nana abanyin

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