shortning if fromula

shamsu203

Board Regular
Joined
Jun 12, 2014
Messages
70
Office Version
  1. 365
Platform
  1. Windows
Hi
I have this formula whcih is copied from a13 to z13. how can i shorten the same . tired xlookup but did not work
=IF(AND($B$2=$AB$4,$D$4=AD4),$AF$12/2,IF(AND($B$2=$AB$5,$D$4=$AD$4),$AF$5/2,IF(AND($B$2=$AB$6,$D$4=$AD$4),$AF$6/2,IF(AND($B$2=$AB$7,$D$4=$AD$4),$AF$7/2,IF(AND($B$2=$AB$8,$D$4=$AD$4),$AF$8/2,IF(AND($B$2=$AB$9,$D$4=$AD$4),$AF$9/2,IF(AND($B$2=$AB$10,$D$4=$AD$4),$AF$10/2,IF(AND($B$2=$AB$11,$D$4=$AD$4),$AF$11/2,0))))))))
where b2 and ab4 to ab11 are names ,d4 and ad4 are dates in the format apr-2008 apr 2030,,af 5 to af 12 are amounts.I would appreciate any help provided . I tried xlookup but no success
Shamsu
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
Does your spreadsheet structure make it possible to copy the content of cell AF12 to AF4? If so, then you would have two well-aligned arrays AF4:AF11 and AB4:AB11 that could be used like this:

=IF($D$4=$AD$4,INDEX($AF$4:$AF$11,MATCH($B$2,$AB$4:$AB$11,0))/2,0)

Also, is there any chance that B2 will not match anything in AB4:AB11? If so, this formula will return an error, so an error trap would be needed to return 0 in that case.

If this is not possible, then what about copying AB4 to AB12...would that be possible? If so, then the ranges in the above formula could be modified slightly.
 
Upvote 0
hi
Tks for ur prompt reply. the answer to ur questions are
contents of af12 can be copied to AF 4 which is blank at the moment. B2 will always match ab4:ab11.
 
Upvote 0
Good, then try copying AF12 to AF4, and then see if the following gives the expected result.

=IF($D$4=$AD$4,INDEX($AF$4:$AF$11,MATCH($B$2,$AB$4:$AB$11,0))/2,0)
 
Upvote 0

Forum statistics

Threads
1,214,912
Messages
6,122,204
Members
449,072
Latest member
DW Draft

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